Skip to content
Clément Cariou edited this page Jan 31, 2021 · 7 revisions

How to use cutom artworks ?

  1. Setup the project
  2. Put your images into the folder images
  3. Modify the file images/images.json (automated soon)
  4. Depending on what you want to do a. Run the server npm start, go to the address displayed in the terminal b. Build the project npm build, and host the build.html file and the image folder
  5. Append ?api=local to the browser url bar (you can set to default in api/api.js)

How to add an API connector ?

You can add an API by adding a js file in the api folder and importing it in api/api.js. It should exports a module with two asynchronious functions :

/** Called when a new page of image objects needs to be loaded
 * @param {number} from - starting index
 * @param {number} to - end index
 * @returns {{image_id: number, ...}[]}: list of image objects
*/
fetchList(from, to)

/** Called to load an image
 * @param {Img} obj - image object
 * @param {number} advicedResolution - image resolution adviced by the dynamic loader
 * @returns {{title: string, image: Blob|ImageData|HTMLCanvasElement...}} - title and image to display
*/
fetchImage(obj, advicedResolution)

You can take a look at the existing APIs for reference. I will be happy to accept Pull Request of API connectors.

Clone this wiki locally