I've been exploring ways to implement some pre-update logic for a layer, and I believe the fetch
method within the layer's props could be the key. Initially, my aim is to understand the default behavior before incorporating custom logic, but I'm encountering difficulties with this initial test.
Here's the snippet of code defining the fetch prop for the layer:
fetch: async (url: string, context: any) => {
return await load(url, context.layer.loaders, context.loaderOptions);
}
In my component, I import load
as follows:
import { load } from '@loaders.gl/core';
Unfortunately, it appears that this setup may not be suitable for TypeScript environments, as evidenced by an error message following the import statement:
Error: node_modules/@loaders.gl/loader-utils/dist/lib/node/fs.d.ts:1:8
- error TS1192: Module '"fs"' has no default export.
- import fs from 'fs';
This issue seems related to improper syntax for importing in TypeScript.
Could you advise on how I can incorporate load
into my Angular project? I know that deck.gl utilizes a load
function during layer updates, based on my observation of a call stack without attempting to override fetch
:
load @ https://localhost:44305/vendor.js:34188
How can I explicitly integrate load
into my overridden fetch
method?
Thank you.