@itwin/core-frontend
Version:
iTwin.js frontend components
30 lines • 1.3 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Tiles
*/
import { assert } from "@itwin/core-bentley";
import { RenderSchedule } from "@itwin/core-common";
import { collectTransferables } from "../../common/imdl/ImdlModel";
import { parseImdlDocument } from "../../common/imdl/ParseImdlDocument";
import { registerWorker } from "../RegisterWorker";
let timeline;
registerWorker({
parse: async (options) => {
const result = await parseImdlDocument({
...options,
data: options.data,
timeline,
});
if (typeof result === "number")
return result;
return { result, transfer: collectTransferables(result) };
},
setTimeline: (arg) => {
assert(undefined === timeline, "setTimeline must be called only once");
timeline = Array.isArray(arg) ? RenderSchedule.Script.fromJSON(arg) : RenderSchedule.ModelTimeline.fromJSON(arg);
},
});
//# sourceMappingURL=Worker.js.map