Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 428x 9634x 9634x 428x 19268x | import type { LoaderOptions } from '../../types';
let options: LoaderOptions = {
// callback to open the object
open(xhr, url) {
xhr.open('get', url, true);
},
// callback allowing customization of the xhr (e.g. adding custom auth headers, cors, etc)
beforeSend: async (/* xhr, imageId */) => {
// before send code
},
// callback allowing modification of the xhr response before creating image objects
beforeProcessing(xhr: XMLHttpRequest) {
return Promise.resolve(xhr.response as ArrayBuffer);
},
// callback allowing modification of newly created image objects
imageCreated(/* image */) {
// image created code
},
strict: false,
};
export function setOptions(newOptions: LoaderOptions): void {
options = Object.assign(options, newOptions);
}
export function getOptions(): LoaderOptions {
return options;
}
|