@loaders.gl/loader-utils
Version:
Framework-independent loaders for 3D graphics formats
35 lines • 1.45 kB
TypeScript
import type { LoaderOptions } from '@loaders.gl/loader-utils';
/** Common properties for all data sources */
export type DataSourceProps = {
url?: string | Blob;
/** LoaderOptions provide an option to override `fetch`. Will also be passed to any sub loaders */
loadOptions?: LoaderOptions;
};
/** base class of all data sources */
export declare abstract class DataSource<PropsT extends DataSourceProps = DataSourceProps> {
abstract data: unknown;
/** A resolved fetch function extracted from loadOptions prop */
fetch: (url: string, options?: RequestInit) => Promise<Response>;
/** The actual load options, if calling a loaders.gl loader */
loadOptions: LoaderOptions;
_needsRefresh: boolean;
props: PropsT;
constructor(props: PropsT);
setProps(props: PropsT): void;
/** Mark this data source as needing a refresh (redraw) */
setNeedsRefresh(): void;
/**
* Does this data source need refreshing?
* @note The specifics of the refresh mechanism depends on type of data source
*/
getNeedsRefresh(clear?: boolean): boolean;
}
/**
* Gets the current fetch function from options
* @todo - move to loader-utils module
* @todo - use in core module counterpart
* @param options
* @param context
*/
export declare function getFetchFunction(options?: LoaderOptions): (url: string, fetchOptions?: RequestInit) => Promise<Response>;
//# sourceMappingURL=data-source.d.ts.map