sdc-pubsub
Version:
Publish Subscribe library using post message for sdc plugins
38 lines • 1.57 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var 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 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_pubsub_1 = require("./base-pubsub");
var PluginPubSub = /** @class */ (function (_super) {
__extends(PluginPubSub, _super);
function PluginPubSub(pluginId, parentUrl, eventsToWait) {
var _this = _super.call(this, pluginId) || this;
_this.register('sdc-hub', window.parent, parentUrl);
_this.subscribe(eventsToWait);
return _this;
}
PluginPubSub.prototype.subscribe = function (eventsToWait) {
var registerData = {
pluginId: this.clientId,
eventsToWait: eventsToWait || []
};
this.notify('PLUGIN_REGISTER', registerData);
};
PluginPubSub.prototype.unsubscribe = function () {
var unregisterData = {
pluginId: this.clientId
};
this.notify('PLUGIN_UNREGISTER', unregisterData);
};
return PluginPubSub;
}(base_pubsub_1.BasePubSub));
exports.PluginPubSub = PluginPubSub;
//# sourceMappingURL=plugin-pubsub.js.map