UNPKG

rx-postmessenger

Version:

Minimal RxJS adapter for the window.postMessage API for request-response streams and notification streams across frame windows.

26 lines (25 loc) 796 B
var RxPostmessengerRequest = /** @class */ (function () { function RxPostmessengerRequest(id, channel, payload, _injectResponse) { this.id = id; this.channel = channel; this.payload = payload; this._injectResponse = _injectResponse; this._isHandled = false; } Object.defineProperty(RxPostmessengerRequest.prototype, "isHandled", { get: function () { return this._isHandled; }, enumerable: false, configurable: true }); RxPostmessengerRequest.prototype.respond = function (data) { if (this._isHandled) { return; } this._injectResponse(data); this._isHandled = true; }; return RxPostmessengerRequest; }()); export { RxPostmessengerRequest };