UNPKG

@simplito/privmx-webendpoint

Version:

PrivMX Web Endpoint library

69 lines (68 loc) 2.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConnectionStatusEventType = void 0; exports.createThreadSubscription = createThreadSubscription; exports.createStoreSubscription = createStoreSubscription; exports.createKvdbSubscription = createKvdbSubscription; exports.createInboxSubscription = createInboxSubscription; exports.createEventSubscription = createEventSubscription; exports.createConnectionSubscription = createConnectionSubscription; exports.createUserEventSubscription = createUserEventSubscription; const __1 = require(".."); function toEventCallback(f) { return { callback: f, symbol: Symbol(), }; } function createThreadSubscription(s) { return { ...s, callbacks: s.callbacks.map(toEventCallback), }; } function createStoreSubscription(s) { return { ...s, callbacks: s.callbacks.map(toEventCallback), }; } function createKvdbSubscription(s) { return { ...s, callbacks: s.callbacks.map(toEventCallback), }; } function createInboxSubscription(s) { return { ...s, callbacks: s.callbacks.map(toEventCallback), }; } function createEventSubscription(s) { return { type: s.channel, selector: s.selector, id: s.id, callbacks: s.callbacks.map(toEventCallback), channel: s.channel, }; } var ConnectionStatusEventType; (function (ConnectionStatusEventType) { ConnectionStatusEventType[ConnectionStatusEventType["LIB_DISCONNECTED"] = 0] = "LIB_DISCONNECTED"; ConnectionStatusEventType[ConnectionStatusEventType["LIB_PLATFORM_DISCONNECTED"] = 1] = "LIB_PLATFORM_DISCONNECTED"; ConnectionStatusEventType[ConnectionStatusEventType["LIB_CONNECTED"] = 2] = "LIB_CONNECTED"; })(ConnectionStatusEventType || (exports.ConnectionStatusEventType = ConnectionStatusEventType = {})); function createConnectionSubscription(s) { return { ...s, callbacks: s.callbacks.map(toEventCallback), }; } function createUserEventSubscription(s) { return { ...s, callbacks: s.callbacks.map(toEventCallback), }; }