import range from "lodash/range";
export class DataURLImageSupport {
    insert(file, done, progressFn) {
        const reader = new FileReader();
        reader.onload = () => {
            const dataURL = reader.result;
            setTimeout(() => {
                done(null, dataURL.toString());
            }, 2000);
        };
        let progress = 0;
        progressFn(progress, 0, 100);
        range(1, 100).forEach(n => {
            setTimeout(() => {
                progressFn(n, n, 100);
            }, n * 20);
        });
        // if external asset support .. add reader.readAsArrayBuffer ..
        reader.readAsDataURL(file);
    }
    delete(src, done) {
        done();
    }
}
