-
Notifications
You must be signed in to change notification settings - Fork 88
Home
Clément Cariou edited this page Mar 28, 2021
·
7 revisions
- Setup the project
- Put your images into the folder images
- Depending on what you want to do :
- Run the server
npm start
, go to the address displayed in the terminal - Build the project
npm build
, and host the build.html file and the image folder
- Append
?api=local
to the browser url bar (you can set the default API in api/api.js)
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.