UNPKG

openfin-browser-adapter

Version:
59 lines (58 loc) 2.43 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var Base_1 = require("./Base"); var Channel_1 = require("./Channel"); var OpenFinMock_1 = require("../OpenFinMock"); var InterApplicationBus = (function (_super) { __extends(InterApplicationBus, _super); function InterApplicationBus() { return _super !== null && _super.apply(this, arguments) || this; } InterApplicationBus.publish = function (topic, message, callback, errCallback) { if (InterApplicationBus.listeners[topic]) { InterApplicationBus.listeners[topic].forEach(function (topicCb) { topicCb(message, '', ''); }); } InterApplicationBus.subscribeListeners.forEach(function (cb) { cb('', topic, ''); }); callback(); }; InterApplicationBus.addSubscribeListener = function (listener) { InterApplicationBus.subscribeListeners.push(listener); }; InterApplicationBus.subscribe = function (senderUuid, name, topic, listener, callback, errCallback) { if (!InterApplicationBus.listeners[topic]) { InterApplicationBus.listeners[topic] = []; } InterApplicationBus.listeners[topic].push(listener); callback(); }; InterApplicationBus.staticMethods = [ 'addUnsubscribeListener', 'removeSubscribeListener', 'removeUnsubscribeListener', 'send', 'unsubscribe', ]; InterApplicationBus.instanceMethods = []; InterApplicationBus.subscribeListeners = []; InterApplicationBus.listeners = {}; InterApplicationBus.Channel = OpenFinMock_1.OpenFinMock.generateMethods('InterApplicationBus.Channel', Channel_1.Channel); return InterApplicationBus; }(Base_1.BaseApiClass)); exports.InterApplicationBus = InterApplicationBus;