this.destroy(); } }); } } suppressDestroy() { this._suppressDestroy = true; } getRuntimeVersions() { return { version, NODE_API_SUPPORTED_VERSION_MAX, NAPI_VERSION_EXPERIMENTAL, NODE_API_DEFAULT_MODULE_API_VERSION }; } createNotSupportWeakRefError(api, message) { return new NotSupportWeakRefError(api, message); } createNotSupportBufferError(api, message) { return new NotSupportBufferError(api, message); } createReference(envObject, handle_id, initialRefcount, ownership) { return Reference.create(envObject, handle_id, initialRefcount, ownership); } createReferenceWithData(envObject, handle_id, initialRefcount, ownership, data) { return ReferenceWithData.create(envObject, handle_id, initialRefcount, ownership, data); } createReferenceWithFinalizer(envObject, handle_id, initialRefcount, ownership, finalize_callback = 0, finalize_data = 0, finalize_hint = 0) { return ReferenceWithFinalizer.create(envObject, handle_id, initialRefcount, ownership, finalize_callback, finalize_data, finalize_hint); } createDeferred(value) { return Deferred.create(this, value); } createEnv(filename, moduleApiVersion, makeDynCall_vppp, makeDynCall_vp, abort, nodeBinding) { return newEnv(this, filename, moduleApiVersion, makeDynCall_vppp, makeDynCall_vp, abort, nodeBinding); } createTrackedFinalizer(envObject, finalize_callback, finalize_data, finalize_hint) { return TrackedFinalizer.create(envObject, finalize_callback, finalize_data, finalize_hint); } getCurrentScope() { return this.scopeStore.currentScope; } addToCurrentScope(value) { return this.scopeStore.currentScope.add(value); } openScope(envObject) { const scope = this.scopeStore.openScope(this.handleStore); if (envObject) envObject.openHandleScopes++; return scope; } closeScope(envObject, _scope) { if (envObject && envObject.openHandleScopes === 0) return; this.scopeStore.closeScope(); if (envObject) envObject.openHandleScopes--; } ensureHandle(value) { switch (value) { case undefined: return HandleStore.UNDEFINED; case null: return HandleStore.NULL; case true: return HandleStore.TRUE; case false: return HandleStore.FALSE; case _global: return HandleStore.GLOBAL; } return this.addToCurrentScope(value); } addCleanupHook(envObject, fn, arg) { this.cleanupQueue.add(envObject, fn, arg); } removeCleanupHook(envObject, fn, arg) { this.cleanupQueue.remove(envObject, fn, arg); } runCleanup() { while (!this.cleanupQueue.empty()) { this.cleanupQueue.drain(); } } increaseWaitingRequestCounter() { var _a; (_a = this.refCounter) === null || _a === void 0 ? void 0 : _a.increase(); } decreaseWaitingRequestCounter() { var _a; (_a = this.refCounter) === null || _a === void 0 ? void 0 : _a.decrease(); } setCanCallIntoJs(value) { this._canCallIntoJs = value; } setStopping(value) { this._isStopping = value; } canCallIntoJs() { return this._canCallIntoJs && !this._isStopping; } destroy() { this.setStopping(true); this.setCanCallIntoJs(false); this.runCleanup(); } } let defaultContext; function createContext() { return new Context(); } function getDefaultContext() { if (!defaultContext) { defaultContext = createContext(); } return defaultContext; } exports.ConstHandle = ConstHandle; exports.Context = Context; exports.Deferred = Deferred; exports.EmnapiError = EmnapiError; exports.Env = Env; exports.External = External; exports.Finalizer = Finalizer; exports.Handle = Handle; exports.HandleScope = HandleScope; exports.HandleStore = HandleStore; exports.NAPI_VERSION_EXPERIMENTAL = NAPI_VERSION_EXPERIMENTAL; exports.NODE_API_DEFAULT_MODULE_API_VERSION = NODE_API_DEFAULT_MODULE_API_VERSION; exports.NODE_API_SUPPORTED_VERSION_MAX = NODE_API_SUPPORTED_VERSION_MAX; exports.NODE_API_SUPPORTED_VERSION_MIN = NODE_API_SUPPORTED_VERSION_MIN; exports.NodeEnv = NodeEnv; exports.NotSupportBufferError = NotSupportBufferError; exports.NotSupportWeakRefError = NotSupportWeakRefError; exports.Persistent = Persistent; exports.RefTracker = RefTracker; exports.Reference = Reference; exports.ReferenceWithData = ReferenceWithData; exports.ReferenceWithFinalizer = ReferenceWithFinalizer; exports.ScopeStore = ScopeStore; exports.Store = Store; exports.TrackedFinalizer = TrackedFinalizer; exports.TryCatch = TryCatch; exports.createContext = createContext; exports.getDefaultContext = getDefaultContext; exports.getExternalValue = getExternalValue; exports.isExternal = isExternal; exports.isReferenceType = isReferenceType; exports.version = version;