@itwin/core-frontend
Version:
iTwin.js frontend components
34 lines • 1.65 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
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.acquireImdlDecoder = acquireImdlDecoder;
const internal_1 = require("../../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
*/
function acquireImdlDecoder(args) {
const parser = (0, internal_1.acquireImdlParser)(args);
return {
release: () => parser.release(),
decode: async (decodeArgs) => {
return (0, internal_1.readImdlContent)({
...args,
...decodeArgs,
modelId: args.batchModelId,
loadEdges: !args.omitEdges,
parseDocument: async (parserOpts) => parser.parse(parserOpts),
});
},
};
}
//# sourceMappingURL=ImdlDecoder.js.map