UNPKG

@simplito/privmx-webendpoint

Version:

PrivMX Web Endpoint library

36 lines (33 loc) 1.01 kB
"use strict"; /*! PrivMX Web Endpoint. Copyright © 2024 Simplito sp. z o.o. This file is part of the PrivMX Platform (https://privmx.dev). This software is Licensed under the PrivMX Free License. See the License for the specific language governing permissions and limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseNative = void 0; class BaseNative { _api; constructor(api) { this._api = api; } get api() { if (!this._api) { throw new Error("This API instance is no longer valid because the connection associated with it has been closed."); } return this._api; } deleteApiRef() { this._api = null; } async runAsync(func) { if (!this.api) { throw new Error("This API instance is no longer valid because the connection associated with it has been closed."); } return this.api.runAsync(func); } } exports.BaseNative = BaseNative;