UNPKG

@loaders.gl/core

Version:

Framework-independent loaders for 3D graphics formats

30 lines (27 loc) 1.15 kB
import { isLoaderObject } from './loader-utils/normalize-loader'; import { mergeLoaderAndUserOptions } from './loader-utils/normalize-options'; import { getAsyncIteratorFromData } from './loader-utils/get-data'; import { getLoaderContext } from './loader-utils/get-loader-context'; import { selectLoader } from './select-loader'; export async function parseInBatches(data, loaders, options, url) { if (!Array.isArray(loaders) && !isLoaderObject(loaders)) { url = options; options = loaders; loaders = null; } const loader = selectLoader(loaders, url, null); options = mergeLoaderAndUserOptions(options, loader); const context = getLoaderContext({ url }, options); return parseWithLoaderInBatches(loader, data, options, context); } function parseWithLoaderInBatches(loader, data, options, context) { if (loader.parseInBatches) { const inputIterator = getAsyncIteratorFromData(data); const outputIterator = loader.parseInBatches(inputIterator, options, context, loader); return outputIterator; } throw new Error('parseWithLoaderInBatchesSync not available'); } //# sourceMappingURL=parse-in-batches.js.map