registerLoaders
The loader registry allows applications to cherry-pick which loaders to include in their application bundle by importing just the loaders they need and registering them during initialization.
Applications can then make all those imported loaders available (via format autodetection) to all subsequent parse
and load
calls, without those calls having to specify which loaders to use.
Usage​
Sample application initialization code that imports and registers loaders:
import {registerLoaders} from '@loaders.gl/core';
import {CSVLoader} from '@loaders.gl/csv';
registerLoaders(CSVLoader);
Some other file that needs to load CSV:
import {load} from '@loaders.gl/core';
// The pre-registered CSVLoader gets auto selected based on file extension...
const data = await load('data.csv');
Functions​
registerLoaders()​
registerLoaders(loaders : Loader | Loader[])
Registers one or more loader objects to a global loader object registry, these loaders will be used if no loader object is supplied to parse
and load
.
loaders
- can be a single loader or an array of loaders. The specified loaders will be added to any previously registered loaders.