UNPKG

@itwin/core-frontend

Version:
31 lines 1.52 kB
/*--------------------------------------------------------------------------------------------- * 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 { acquireImdlParser, readImdlContent } from "../../tile/internal"; /** Acquire shared ownership of an [[ImdlDecoder]]. * Decoders are reference-counted, because they make use of reference-counted [[ImdlParser]]s internally. * The caller of this function increments the reference count of the decoder and is responsible * for decrementing it by calling [[ImdlDecoder.release]] when it is no longer needed. Typically, a decoder's lifetime is tied to the * lifetime of some `Disposable` object like a [[TileTree]] - acquired in the constructor, and released in the `[Symbol.dispose]` method. * @internal */ export function acquireImdlDecoder(args) { const parser = acquireImdlParser(args); return { release: () => parser.release(), decode: async (decodeArgs) => { return readImdlContent({ ...args, ...decodeArgs, modelId: args.batchModelId, loadEdges: !args.omitEdges, parseDocument: async (parserOpts) => parser.parse(parserOpts), }); }, }; } //# sourceMappingURL=ImdlDecoder.js.map