Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loader registry #129

Merged
merged 2 commits into from
Mar 25, 2019
Merged

Add loader registry #129

merged 2 commits into from
Mar 25, 2019

Conversation

ibgreen
Copy link
Collaborator

@ibgreen ibgreen commented Mar 22, 2019

A lot of doc changes creating noise so I copy the essential doc here

Loader Registry

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 parseFile and loadFile calls, without those calls having to specify which loaders to use.

Usage

Initialization 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 {loadFile} from '@loaders.gl/core';

// The pre-registered SVLoader gets auto selected based on file extension...
const data = await loadFile('data.csv');

Functions

registerLoaders(loaders : Object | Object[])

Registers one or more loader objects to a global loader object registry, these loaders will be used if no loader object is supplied to parseFile and loadFile.

  • loaders - can be a single loader or an array of loaders. The specified loaders will be added to any previously registered loaders.

@coveralls
Copy link

coveralls commented Mar 22, 2019

Coverage Status

Coverage increased (+0.04%) to 26.93% when pulling 26b6974 on ib/register-loaders into 63a4765 on master.

@ibgreen ibgreen merged commit de9cf9e into master Mar 25, 2019
@ibgreen ibgreen deleted the ib/register-loaders branch March 25, 2019 15:17
belom88 pushed a commit that referenced this pull request Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants