@loaders.gl/core
Version:
The core API for working with loaders.gl loaders and writers
56 lines (55 loc) • 1.6 kB
JavaScript
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
// __VERSION__ is injected by babel-plugin-version-inline
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
const VERSION = typeof "4.3.3" !== 'undefined' ? "4.3.3" : 'latest';
/**
* Loads any data and returns null (or optionally passes through data unparsed)
*/
export const NullWorkerLoader = {
dataType: null,
batchType: null,
name: 'Null loader',
id: 'null',
module: 'core',
version: VERSION,
worker: true,
mimeTypes: ['application/x.empty'],
extensions: ['null'],
tests: [() => false],
options: {
null: {}
}
};
/**
* Loads any data and returns null (or optionally passes through data unparsed)
*/
export const NullLoader = {
dataType: null,
batchType: null,
name: 'Null loader',
id: 'null',
module: 'core',
version: VERSION,
mimeTypes: ['application/x.empty'],
extensions: ['null'],
parse: async (arrayBuffer, options, context) => parseSync(arrayBuffer, options || {}, context),
parseSync,
parseInBatches: async function* generator(asyncIterator, options, context) {
for await (const batch of asyncIterator) {
yield parseSync(batch, options, context);
}
},
tests: [() => false],
options: {
null: {}
}
};
/**
* Returns arguments passed to the parse API in a format that can be transferred to a
* web worker. The `context` parameter is stripped using JSON.stringify & parse.
*/
function parseSync(arrayBuffer, options, context) {
return null;
}