UNPKG

hatch

Version:

Eve events over the wire using HTTP EventSource

24 lines (23 loc) 781 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var eve = require("eve"); var EventChannel = /** @class */ (function () { function EventChannel(id, handlers) { this.id = id; this.handlers = handlers; this.baseArgs = ['hatch', id]; } EventChannel.prototype.emit = function (inputName) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } var name = this.baseArgs.concat([inputName.split('.')]).join('.'); eve.apply(void 0, [name, this].concat(values)); }; EventChannel.prototype.close = function () { this.handlers.onClose(); }; return EventChannel; }()); exports.EventChannel = EventChannel;