<script>
import { onMount } from 'svelte';
import * as THREE from 'three';
const url = 'https://images.unsplash.com/photo-1608229063899-4fd8fb97969b?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=100&w=100';
let file;
let imageBitmap;
let cacheEnabled = false;
$: THREE.Cache.enabled = cacheEnabled;
$: cacheEnabled, (async () => {
console.log('loading file');
const fileLoader = new THREE.FileLoader();
file = await (new Promise((resolve) => {
fileLoader.load(url, (v) => {
console.log('fileLoader onLoad');
resolve(v);
});
}));
console.log(THREE.Cache.get(url));
console.log('loading imageBitmap');
const imageBitmapLoader = new THREE.ImageBitmapLoader();
imageBitmap = await (new Promise((resolve) => {
imageBitmapLoader.load(url, (v) => {
console.log('imageBitmapLoader onLoad');
resolve(v);
});
}));
console.log(THREE.Cache.get(url));
})();
console.log('finished..');