Last active
August 29, 2015 14:17
-
-
Save knalli/89cd8bf4ba98590e3c31 to your computer and use it in GitHub Desktop.
angular-vertxbus ES6 Comparsion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | |
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | |
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | |
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; | |
angular.module("knalli.angular-vertxbus").provider("vertxEventBus", function () { | |
var _this = this; | |
// global constants | |
var CONSTANTS = { | |
MODULE: "angular-vertxbus", | |
COMPONENT: "wrapper" | |
}; | |
// default options for this module: TODO doc | |
var DEFAULT_OPTIONS = { | |
enabled: true, | |
debugEnabled: false, | |
prefix: "vertx-eventbus.", | |
urlServer: "" + location.protocol + "//" + location.hostname + ((function () { | |
if (location.port) { | |
return ":" + location.port; | |
} | |
})() || ""), | |
urlPath: "/eventbus", | |
reconnectEnabled: true, | |
sockjsStateInterval: 10000, | |
sockjsReconnectInterval: 10000, | |
sockjsOptions: {}, | |
messageBuffer: 0 | |
}; | |
// options (globally, application-wide) | |
var options = angular.extend({}, DEFAULT_OPTIONS); | |
this.enable = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.enabled : arguments[0]; | |
options.enabled = value === true; | |
return _this; | |
}; | |
this.enable.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.enable"; | |
this.useDebug = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.debugEnabled : arguments[0]; | |
options.debugEnabled = value === true; | |
return _this; | |
}; | |
this.useDebug.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useDebug"; | |
this.usePrefix = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.prefix : arguments[0]; | |
options.prefix = value; | |
return _this; | |
}; | |
this.usePrefix.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.usePrefix"; | |
this.useUrlServer = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.urlServer : arguments[0]; | |
options.urlServer = value; | |
return _this; | |
}; | |
this.useUrlServer.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useUrlServer"; | |
this.useUrlPath = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.urlPath : arguments[0]; | |
options.urlPath = value; | |
return _this; | |
}; | |
this.useUrlPath.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useUrlPath"; | |
this.useReconnect = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.reconnectEnabled : arguments[0]; | |
options.reconnectEnabled = value; | |
return _this; | |
}; | |
this.useReconnect.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useReconnect"; | |
this.useSockJsStateInterval = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.sockjsStateInterval : arguments[0]; | |
options.sockjsStateInterval = value; | |
return _this; | |
}; | |
this.useSockJsStateInterval.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useSockJsStateInterval"; | |
this.useSockJsReconnectInterval = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.sockjsReconnectInterval : arguments[0]; | |
options.sockjsReconnectInterval = value; | |
return _this; | |
}; | |
this.useSockJsReconnectInterval.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useSockJsReconnectInterval"; | |
this.useSockJsOptions = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.sockjsOptions : arguments[0]; | |
options.sockjsOptions = value; | |
return _this; | |
}; | |
this.useSockJsOptions.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useSockJsOptions"; | |
this.useMessageBuffer = function () { | |
var value = arguments[0] === undefined ? DEFAULT_OPTIONS.messageBuffer : arguments[0]; | |
options.messageBuffer = value; | |
return _this; | |
}; | |
this.useMessageBuffer.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useMessageBuffer"; | |
/* | |
A stub representing the VertX Event Bus (core functionality) | |
Because the Event Bus cannot handle a reconnect (because of the underlaying SockJS), a new instance of the bus have to be created. | |
This stub ensures only one object holding the current active instance of the bus. | |
The stub supports theses VertX Event Bus APIs: | |
- close() | |
- login(username, password, replyHandler) | |
- send(address, message, handler) | |
- publish(address, message) | |
- registerHandler(adress, handler) | |
- unregisterHandler(address, handler) | |
- readyState() | |
Furthermore, the stub supports theses extra APIs: | |
- recconnect() | |
*/ | |
this.$get = function ($timeout, $log) { | |
// Current options (merged defaults with application-wide settings) | |
var _angular$extend = angular.extend({}, DEFAULT_OPTIONS, options); | |
var enabled = _angular$extend.enabled; | |
var debugEnabled = _angular$extend.debugEnabled; | |
var prefix = _angular$extend.prefix; | |
var urlServer = _angular$extend.urlServer; | |
var urlPath = _angular$extend.urlPath; | |
var reconnectEnabled = _angular$extend.reconnectEnabled; | |
var sockjsStateInterval = _angular$extend.sockjsStateInterval; | |
var sockjsReconnectInterval = _angular$extend.sockjsReconnectInterval; | |
var sockjsOptions = _angular$extend.sockjsOptions; | |
var messageBuffer = _angular$extend.messageBuffer; | |
if (enabled && vertx && vertx.EventBus) { | |
if (debugEnabled) { | |
$log.debug("[Vert.x EB Stub] Enabled"); | |
} | |
return new ProxyEventbusWrapper(vertx.EventBus, $timeout, $log, { | |
enabled: enabled, | |
debugEnabled: debugEnabled, | |
prefix: prefix, | |
urlServer: urlServer, | |
urlPath: urlPath, | |
reconnectEnabled: reconnectEnabled, | |
sockjsStateInterval: sockjsStateInterval, | |
sockjsReconnectInterval: sockjsReconnectInterval, | |
sockjsOptions: sockjsOptions, | |
messageBuffer: messageBuffer | |
}); | |
} else { | |
if (debugEnabled) { | |
$log.debug("[Vert.x EB Stub] Disabled"); | |
} | |
return new SentinelEventbusWrapper(); | |
} | |
}; // $get | |
var EventbusWrapper = (function () { | |
function EventbusWrapper() { | |
_classCallCheck(this, EventbusWrapper); | |
} | |
_createClass(EventbusWrapper, { | |
connect: { | |
value: function connect() {} | |
}, | |
reconnect: { | |
value: function reconnect() {} | |
}, | |
close: { | |
value: function close() {} | |
}, | |
login: { | |
value: function login(username, password, replyHandler) {} | |
}, | |
send: { | |
value: function send(address, message, replyHandler) {} | |
}, | |
publish: { | |
value: function publish(address, message) {} | |
}, | |
registerHandler: { | |
value: function registerHandler(address, handler) {} | |
}, | |
unregisterHandler: { | |
value: function unregisterHandler(address, handler) {} | |
}, | |
readyState: { | |
value: function readyState() {} | |
}, | |
getOptions: { | |
value: function getOptions() { | |
return {}; | |
} | |
}, | |
onopen: { | |
// empty: can be overriden by externals | |
value: function onopen() {} | |
}, | |
onclose: { | |
// empty: can be overriden by externals | |
value: function onclose() {} | |
} | |
}); | |
return EventbusWrapper; | |
})(); | |
var ProxyEventbusWrapper = (function (_EventbusWrapper) { | |
function ProxyEventbusWrapper(EventBus, $timeout, $log, _ref) { | |
var enabled = _ref.enabled; | |
var debugEnabled = _ref.debugEnabled; | |
var prefix = _ref.prefix; | |
var urlServer = _ref.urlServer; | |
var urlPath = _ref.urlPath; | |
var reconnectEnabled = _ref.reconnectEnabled; | |
var sockjsStateInterval = _ref.sockjsStateInterval; | |
var sockjsReconnectInterval = _ref.sockjsReconnectInterval; | |
var sockjsOptions = _ref.sockjsOptions; | |
var messageBuffer = _ref.messageBuffer; | |
_classCallCheck(this, ProxyEventbusWrapper); | |
_get(Object.getPrototypeOf(ProxyEventbusWrapper.prototype), "constructor", this).call(this); | |
// actual EventBus type | |
this.EventBus = EventBus; | |
this.$timeout = $timeout; | |
this.$log = $log; | |
this.options = { | |
enabled: enabled, | |
debugEnabled: debugEnabled, | |
prefix: prefix, | |
urlServer: urlServer, | |
urlPath: urlPath, | |
reconnectEnabled: reconnectEnabled, | |
sockjsStateInterval: sockjsStateInterval, | |
sockjsReconnectInterval: sockjsReconnectInterval, | |
sockjsOptions: sockjsOptions, | |
messageBuffer: messageBuffer | |
}; | |
// asap create connection | |
this.connect(); | |
} | |
_inherits(ProxyEventbusWrapper, _EventbusWrapper); | |
_createClass(ProxyEventbusWrapper, { | |
connect: { | |
value: function connect() { | |
var _this2 = this; | |
var url = "" + this.options.urlServer + "" + this.options.urlPath; | |
if (this.options.debugEnabled) { | |
this.$log.debug("[Vert.x EB Stub] Enabled: connecting '" + url + "'"); | |
} | |
// Because we have rebuild an EventBus object (because it have to rebuild a SockJS object) | |
// we must wrap the object. Therefore, we have to mimic the behavior of onopen and onclose each time. | |
this.instance = new this.EventBus(url, undefined, this.options.sockjsOptions); | |
this.instance.onopen = function () { | |
if (_this2.options.debugEnabled) { | |
_this2.$log.debug("[Vert.x EB Stub] Connected"); | |
} | |
if (angular.isFunction(_this2.onopen)) { | |
_this2.onopen(); | |
} | |
}; | |
this.instance.onclose = function () { | |
if (_this2.options.debugEnabled) { | |
_this2.$log.debug("[Vert.x EB Stub] Reconnect in " + _this2.options.sockjsReconnectInterval + "ms"); | |
} | |
if (angular.isFunction(_this2.onclose)) { | |
_this2.onclose(); | |
} | |
_this2.instance = undefined; | |
if (_this2.options.reconnectEnabled) { | |
_this2.$timeout(function () { | |
return _this2.connect(); | |
}, _this2.options.sockjsReconnectInterval); | |
} | |
}; | |
} | |
}, | |
reconnect: { | |
value: function reconnect() { | |
if (this.instance) { | |
return this.instance.close(); | |
} | |
} | |
}, | |
close: { | |
value: function close() { | |
if (this.instance) { | |
return this.instance.close(); | |
} | |
} | |
}, | |
login: { | |
value: function login(username, password, replyHandler) { | |
if (this.instance) { | |
return this.instance.login(username, password, replyHandler); | |
} | |
} | |
}, | |
send: { | |
value: function send(address, message, replyHandler) { | |
if (this.instance) { | |
return this.instance.send(address, message, replyHandler); | |
} | |
} | |
}, | |
publish: { | |
value: function publish(address, message) { | |
if (this.instance) { | |
return this.instance.publish(address, message); | |
} | |
} | |
}, | |
registerHandler: { | |
value: function registerHandler(address, handler) { | |
var _this2 = this; | |
if (this.instance) { | |
this.instance.registerHandler(address, handler); | |
// and return the deregister callback | |
var deconstructor = function () { | |
_this2.unregisterHandler(address, handler); | |
}; | |
deconstructor.displayName = "" + CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": EventBusStub.registerHandler (deconstructor)"; | |
return deconstructor; | |
} | |
} | |
}, | |
unregisterHandler: { | |
value: function unregisterHandler(address, handler) { | |
if (this.instance) { | |
return this.instance.unregisterHandler(address, handler); | |
} | |
} | |
}, | |
readyState: { | |
value: function readyState() { | |
if (this.instance) { | |
return this.instance.readyState(); | |
} else { | |
return this.EventBus.CLOSED; | |
} | |
} | |
}, | |
getOptions: { | |
value: function getOptions() { | |
// clone options | |
return angular.extend({}, this.options); | |
} | |
} | |
}); | |
return ProxyEventbusWrapper; | |
})(EventbusWrapper); | |
var SentinelEventbusWrapper = (function (_EventbusWrapper2) { | |
function SentinelEventbusWrapper() { | |
_classCallCheck(this, SentinelEventbusWrapper); | |
if (_EventbusWrapper2 != null) { | |
_EventbusWrapper2.apply(this, arguments); | |
} | |
} | |
_inherits(SentinelEventbusWrapper, _EventbusWrapper2); | |
return SentinelEventbusWrapper; | |
})(EventbusWrapper); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('knalli.angular-vertxbus') | |
.provider('vertxEventBus', function () { | |
// global constants | |
const CONSTANTS = { | |
MODULE: 'angular-vertxbus', | |
COMPONENT: 'wrapper' | |
} | |
// default options for this module: TODO doc | |
const DEFAULT_OPTIONS = { | |
enabled: true, | |
debugEnabled: false, | |
prefix: 'vertx-eventbus.', | |
urlServer: `${location.protocol}//${location.hostname}` + ((() => {if (location.port) { return `:${location.port}` }})() || ''), | |
urlPath: '/eventbus', | |
reconnectEnabled: true, | |
sockjsStateInterval: 10000, | |
sockjsReconnectInterval: 10000, | |
sockjsOptions: {}, | |
messageBuffer: 0 | |
} | |
// options (globally, application-wide) | |
var options = angular.extend({}, DEFAULT_OPTIONS) | |
this.enable = (value = DEFAULT_OPTIONS.enabled) => { | |
options.enabled = (value === true) | |
return this | |
} | |
this.enable.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.enable` | |
this.useDebug = (value = DEFAULT_OPTIONS.debugEnabled) => { | |
options.debugEnabled = (value === true) | |
return this | |
} | |
this.useDebug.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.useDebug` | |
this.usePrefix = (value = DEFAULT_OPTIONS.prefix) => { | |
options.prefix = value | |
return this | |
} | |
this.usePrefix.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.usePrefix` | |
this.useUrlServer = (value = DEFAULT_OPTIONS.urlServer) => { | |
options.urlServer = value | |
return this | |
} | |
this.useUrlServer.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.useUrlServer` | |
this.useUrlPath = (value = DEFAULT_OPTIONS.urlPath) => { | |
options.urlPath = value | |
return this | |
} | |
this.useUrlPath.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.useUrlPath` | |
this.useReconnect = (value = DEFAULT_OPTIONS.reconnectEnabled) => { | |
options.reconnectEnabled = value | |
return this | |
} | |
this.useReconnect.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.useReconnect` | |
this.useSockJsStateInterval = (value = DEFAULT_OPTIONS.sockjsStateInterval) => { | |
options.sockjsStateInterval = value | |
return this | |
} | |
this.useSockJsStateInterval.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.useSockJsStateInterval` | |
this.useSockJsReconnectInterval = (value = DEFAULT_OPTIONS.sockjsReconnectInterval) => { | |
options.sockjsReconnectInterval = value | |
return this | |
} | |
this.useSockJsReconnectInterval.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.useSockJsReconnectInterval` | |
this.useSockJsOptions = (value = DEFAULT_OPTIONS.sockjsOptions) => { | |
options.sockjsOptions = value | |
return this | |
} | |
this.useSockJsOptions.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.useSockJsOptions` | |
this.useMessageBuffer = (value = DEFAULT_OPTIONS.messageBuffer) => { | |
options.messageBuffer = value | |
return this | |
} | |
this.useMessageBuffer.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: provider.useMessageBuffer` | |
/* | |
A stub representing the VertX Event Bus (core functionality) | |
Because the Event Bus cannot handle a reconnect (because of the underlaying SockJS), a new instance of the bus have to be created. | |
This stub ensures only one object holding the current active instance of the bus. | |
The stub supports theses VertX Event Bus APIs: | |
- close() | |
- login(username, password, replyHandler) | |
- send(address, message, handler) | |
- publish(address, message) | |
- registerHandler(adress, handler) | |
- unregisterHandler(address, handler) | |
- readyState() | |
Furthermore, the stub supports theses extra APIs: | |
- recconnect() | |
*/ | |
this.$get = ($timeout, $log) => { | |
// Current options (merged defaults with application-wide settings) | |
var { | |
enabled, | |
debugEnabled, | |
prefix, | |
urlServer, | |
urlPath, | |
reconnectEnabled, | |
sockjsStateInterval, | |
sockjsReconnectInterval, | |
sockjsOptions, | |
messageBuffer | |
} = angular.extend({}, DEFAULT_OPTIONS, options) | |
if (enabled && vertx && vertx.EventBus) { | |
if (debugEnabled) { | |
$log.debug("[Vert.x EB Stub] Enabled") | |
} | |
return new ProxyEventbusWrapper(vertx.EventBus, $timeout, $log, { | |
enabled, | |
debugEnabled, | |
prefix, | |
urlServer, | |
urlPath, | |
reconnectEnabled, | |
sockjsStateInterval, | |
sockjsReconnectInterval, | |
sockjsOptions, | |
messageBuffer | |
}) | |
} else { | |
if (debugEnabled) { | |
$log.debug("[Vert.x EB Stub] Disabled") | |
} | |
return new SentinelEventbusWrapper() | |
} | |
} // $get | |
class EventbusWrapper { | |
constructor() {} | |
connect() {} | |
reconnect() {} | |
close() {} | |
login(username, password, replyHandler) {} | |
send(address, message, replyHandler) {} | |
publish(address, message) { } | |
registerHandler(address, handler) { } | |
unregisterHandler(address, handler) {} | |
readyState() {} | |
getOptions() { | |
return {} | |
} | |
// empty: can be overriden by externals | |
onopen() {} | |
// empty: can be overriden by externals | |
onclose() {} | |
} | |
class ProxyEventbusWrapper extends EventbusWrapper { | |
constructor(EventBus, $timeout, $log, { | |
enabled, | |
debugEnabled, | |
prefix, | |
urlServer, | |
urlPath, | |
reconnectEnabled, | |
sockjsStateInterval, | |
sockjsReconnectInterval, | |
sockjsOptions, | |
messageBuffer | |
}) { | |
super() | |
// actual EventBus type | |
this.EventBus = EventBus | |
this.$timeout = $timeout | |
this.$log = $log | |
this.options = { | |
enabled, | |
debugEnabled, | |
prefix, | |
urlServer, | |
urlPath, | |
reconnectEnabled, | |
sockjsStateInterval, | |
sockjsReconnectInterval, | |
sockjsOptions, | |
messageBuffer | |
} | |
// asap create connection | |
this.connect() | |
} | |
connect() { | |
let url = `${this.options.urlServer}${this.options.urlPath}` | |
if (this.options.debugEnabled) { | |
this.$log.debug(`[Vert.x EB Stub] Enabled: connecting '${url}'`) | |
} | |
// Because we have rebuild an EventBus object (because it have to rebuild a SockJS object) | |
// we must wrap the object. Therefore, we have to mimic the behavior of onopen and onclose each time. | |
this.instance = new this.EventBus(url, undefined, this.options.sockjsOptions) | |
this.instance.onopen = () => { | |
if (this.options.debugEnabled) { | |
this.$log.debug("[Vert.x EB Stub] Connected") | |
} | |
if (angular.isFunction(this.onopen)) { | |
this.onopen() | |
} | |
} | |
this.instance.onclose = () => { | |
if (this.options.debugEnabled) { | |
this.$log.debug(`[Vert.x EB Stub] Reconnect in ${this.options.sockjsReconnectInterval}ms`) | |
} | |
if (angular.isFunction(this.onclose)) { | |
this.onclose() | |
} | |
this.instance = undefined | |
if (this.options.reconnectEnabled) { | |
this.$timeout((() => this.connect()), this.options.sockjsReconnectInterval) | |
} | |
} | |
} | |
reconnect() { | |
if (this.instance) { | |
return this.instance.close() | |
} | |
} | |
close() { | |
if (this.instance) { | |
return this.instance.close() | |
} | |
} | |
login(username, password, replyHandler) { | |
if (this.instance) { | |
return this.instance.login(username, password, replyHandler) | |
} | |
} | |
send(address, message, replyHandler) { | |
if (this.instance) { | |
return this.instance.send(address, message, replyHandler) | |
} | |
} | |
publish(address, message) { | |
if (this.instance) { | |
return this.instance.publish(address, message) | |
} | |
} | |
registerHandler(address, handler) { | |
if (this.instance) { | |
this.instance.registerHandler(address, handler) | |
// and return the deregister callback | |
let deconstructor = () => { | |
this.unregisterHandler(address, handler) | |
} | |
deconstructor.displayName = `${CONSTANTS.MODULE}/${CONSTANTS.COMPONENT}: EventBusStub.registerHandler (deconstructor)` | |
return deconstructor | |
} | |
} | |
unregisterHandler(address, handler) { | |
if (this.instance) { | |
return this.instance.unregisterHandler(address, handler) | |
} | |
} | |
readyState() { | |
if (this.instance) { | |
return this.instance.readyState() | |
} else { | |
return this.EventBus.CLOSED; | |
} | |
} | |
getOptions() { | |
// clone options | |
return angular.extend({}, this.options) | |
} | |
} | |
class SentinelEventbusWrapper extends EventbusWrapper {} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('knalli.angular-vertxbus') | |
.provider('vertxEventBus', function () {var PRS$0 = (function(o,t){o["__proto__"]={"a":t};return o["a"]===t})({},{});var DP$0 = Object.defineProperty;var GOPD$0 = Object.getOwnPropertyDescriptor;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,GOPD$0(s,p));}}return t};var SP$0 = Object.setPrototypeOf||function(o,p){if(PRS$0){o["__proto__"]=p;}else {DP$0(o,"__proto__",{"value":p,"configurable":true,"enumerable":false,"writable":true});}return o};var OC$0 = Object.create;var this$0 = this; | |
// global constants | |
var CONSTANTS = { | |
MODULE: 'angular-vertxbus', | |
COMPONENT: 'wrapper' | |
} | |
// default options for this module: TODO doc | |
var DEFAULT_OPTIONS = { | |
enabled: true, | |
debugEnabled: false, | |
prefix: 'vertx-eventbus.', | |
urlServer: (("" + (location.protocol)) + ("//" + (location.hostname)) + "") + ((function() {if (location.port) { return (":" + (location.port)) }})() || ''), | |
urlPath: '/eventbus', | |
reconnectEnabled: true, | |
sockjsStateInterval: 10000, | |
sockjsReconnectInterval: 10000, | |
sockjsOptions: {}, | |
messageBuffer: 0 | |
} | |
// options (globally, application-wide) | |
var options = angular.extend({}, DEFAULT_OPTIONS) | |
this.enable = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.enabled; | |
options.enabled = (value === true) | |
return this$0 | |
} | |
this.enable.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.enable") | |
this.useDebug = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.debugEnabled; | |
options.debugEnabled = (value === true) | |
return this$0 | |
} | |
this.useDebug.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.useDebug") | |
this.usePrefix = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.prefix; | |
options.prefix = value | |
return this$0 | |
} | |
this.usePrefix.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.usePrefix") | |
this.useUrlServer = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.urlServer; | |
options.urlServer = value | |
return this$0 | |
} | |
this.useUrlServer.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.useUrlServer") | |
this.useUrlPath = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.urlPath; | |
options.urlPath = value | |
return this$0 | |
} | |
this.useUrlPath.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.useUrlPath") | |
this.useReconnect = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.reconnectEnabled; | |
options.reconnectEnabled = value | |
return this$0 | |
} | |
this.useReconnect.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.useReconnect") | |
this.useSockJsStateInterval = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.sockjsStateInterval; | |
options.sockjsStateInterval = value | |
return this$0 | |
} | |
this.useSockJsStateInterval.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.useSockJsStateInterval") | |
this.useSockJsReconnectInterval = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.sockjsReconnectInterval; | |
options.sockjsReconnectInterval = value | |
return this$0 | |
} | |
this.useSockJsReconnectInterval.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.useSockJsReconnectInterval") | |
this.useSockJsOptions = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.sockjsOptions; | |
options.sockjsOptions = value | |
return this$0 | |
} | |
this.useSockJsOptions.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.useSockJsOptions") | |
this.useMessageBuffer = function() {var value = arguments[0];if(value === void 0)value = DEFAULT_OPTIONS.messageBuffer; | |
options.messageBuffer = value | |
return this$0 | |
} | |
this.useMessageBuffer.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": provider.useMessageBuffer") | |
/* | |
A stub representing the VertX Event Bus (core functionality) | |
Because the Event Bus cannot handle a reconnect (because of the underlaying SockJS), a new instance of the bus have to be created. | |
This stub ensures only one object holding the current active instance of the bus. | |
The stub supports theses VertX Event Bus APIs: | |
- close() | |
- login(username, password, replyHandler) | |
- send(address, message, handler) | |
- publish(address, message) | |
- registerHandler(adress, handler) | |
- unregisterHandler(address, handler) | |
- readyState() | |
Furthermore, the stub supports theses extra APIs: | |
- recconnect() | |
*/ | |
this.$get = function($timeout, $log) { | |
// Current options (merged defaults with application-wide settings) | |
var enabled = (messageBuffer = angular.extend({}, DEFAULT_OPTIONS, options)).enabled | |
, debugEnabled = messageBuffer.debugEnabled | |
, prefix = messageBuffer.prefix | |
, urlServer = messageBuffer.urlServer | |
, urlPath = messageBuffer.urlPath | |
, reconnectEnabled = messageBuffer.reconnectEnabled | |
, sockjsStateInterval = messageBuffer.sockjsStateInterval | |
, sockjsReconnectInterval = messageBuffer.sockjsReconnectInterval | |
, sockjsOptions = messageBuffer.sockjsOptions | |
, messageBuffer = messageBuffer.messageBuffer | |
if (enabled && vertx && vertx.EventBus) { | |
if (debugEnabled) { | |
$log.debug("[Vert.x EB Stub] Enabled") | |
} | |
return new ProxyEventbusWrapper(vertx.EventBus, $timeout, $log, { | |
enabled: enabled, | |
debugEnabled: debugEnabled, | |
prefix: prefix, | |
urlServer: urlServer, | |
urlPath: urlPath, | |
reconnectEnabled: reconnectEnabled, | |
sockjsStateInterval: sockjsStateInterval, | |
sockjsReconnectInterval: sockjsReconnectInterval, | |
sockjsOptions: sockjsOptions, | |
messageBuffer: messageBuffer | |
}) | |
} else { | |
if (debugEnabled) { | |
$log.debug("[Vert.x EB Stub] Disabled") | |
} | |
return new SentinelEventbusWrapper() | |
} | |
} // $get | |
var EventbusWrapper = (function(){"use strict";var proto$0={}; | |
function EventbusWrapper() {}DP$0(EventbusWrapper,"prototype",{"configurable":false,"enumerable":false,"writable":false}); | |
proto$0.connect = function() {}; | |
proto$0.reconnect = function() {}; | |
proto$0.close = function() {}; | |
proto$0.login = function(username, password, replyHandler) {}; | |
proto$0.send = function(address, message, replyHandler) {}; | |
proto$0.publish = function(address, message) { }; | |
proto$0.registerHandler = function(address, handler) { }; | |
proto$0.unregisterHandler = function(address, handler) {}; | |
proto$0.readyState = function() {}; | |
proto$0.getOptions = function() { | |
return {} | |
}; | |
// empty: can be overriden by externals | |
proto$0.onopen = function() {}; | |
// empty: can be overriden by externals | |
proto$0.onclose = function() {}; | |
MIXIN$0(EventbusWrapper.prototype,proto$0);proto$0=void 0;return EventbusWrapper;})(); | |
var ProxyEventbusWrapper = (function(super$0){"use strict";if(!PRS$0)MIXIN$0(ProxyEventbusWrapper, super$0);var proto$0={}; | |
function ProxyEventbusWrapper(EventBus, $timeout, $log, messageBuffer) {var enabled = messageBuffer.enabled | |
, debugEnabled = messageBuffer.debugEnabled | |
, prefix = messageBuffer.prefix | |
, urlServer = messageBuffer.urlServer | |
, urlPath = messageBuffer.urlPath | |
, reconnectEnabled = messageBuffer.reconnectEnabled | |
, sockjsStateInterval = messageBuffer.sockjsStateInterval | |
, sockjsReconnectInterval = messageBuffer.sockjsReconnectInterval | |
, sockjsOptions = messageBuffer.sockjsOptions | |
, messageBuffer = messageBuffer.messageBuffer | |
; | |
super$0.call(this) | |
// actual EventBus type | |
this.EventBus = EventBus | |
this.$timeout = $timeout | |
this.$log = $log | |
this.options = { | |
enabled: enabled, | |
debugEnabled: debugEnabled, | |
prefix: prefix, | |
urlServer: urlServer, | |
urlPath: urlPath, | |
reconnectEnabled: reconnectEnabled, | |
sockjsStateInterval: sockjsStateInterval, | |
sockjsReconnectInterval: sockjsReconnectInterval, | |
sockjsOptions: sockjsOptions, | |
messageBuffer: messageBuffer | |
} | |
// asap create connection | |
this.connect() | |
}if(super$0!==null)SP$0(ProxyEventbusWrapper,super$0);ProxyEventbusWrapper.prototype = OC$0(super$0!==null?super$0.prototype:null,{"constructor":{"value":ProxyEventbusWrapper,"configurable":true,"writable":true}});DP$0(ProxyEventbusWrapper,"prototype",{"configurable":false,"enumerable":false,"writable":false}); | |
proto$0.connect = function() {var this$0 = this; | |
var url = (("" + (this.options.urlServer)) + ("" + (this.options.urlPath)) + "") | |
if (this.options.debugEnabled) { | |
this.$log.debug((("[Vert.x EB Stub] Enabled: connecting '" + url) + "'")) | |
} | |
// Because we have rebuild an EventBus object (because it have to rebuild a SockJS object) | |
// we must wrap the object. Therefore, we have to mimic the behavior of onopen and onclose each time. | |
this.instance = new this.EventBus(url, undefined, this.options.sockjsOptions) | |
this.instance.onopen = function() { | |
if (this$0.options.debugEnabled) { | |
this$0.$log.debug("[Vert.x EB Stub] Connected") | |
} | |
if (angular.isFunction(this$0.onopen)) { | |
this$0.onopen() | |
} | |
} | |
this.instance.onclose = function() { | |
if (this$0.options.debugEnabled) { | |
this$0.$log.debug((("[Vert.x EB Stub] Reconnect in " + (this$0.options.sockjsReconnectInterval)) + "ms")) | |
} | |
if (angular.isFunction(this$0.onclose)) { | |
this$0.onclose() | |
} | |
this$0.instance = undefined | |
if (this$0.options.reconnectEnabled) { | |
this$0.$timeout((function() {return this$0.connect()}), this$0.options.sockjsReconnectInterval) | |
} | |
} | |
}; | |
proto$0.reconnect = function() { | |
if (this.instance) { | |
return this.instance.close() | |
} | |
}; | |
proto$0.close = function() { | |
if (this.instance) { | |
return this.instance.close() | |
} | |
}; | |
proto$0.login = function(username, password, replyHandler) { | |
if (this.instance) { | |
return this.instance.login(username, password, replyHandler) | |
} | |
}; | |
proto$0.send = function(address, message, replyHandler) { | |
if (this.instance) { | |
return this.instance.send(address, message, replyHandler) | |
} | |
}; | |
proto$0.publish = function(address, message) { | |
if (this.instance) { | |
return this.instance.publish(address, message) | |
} | |
}; | |
proto$0.registerHandler = function(address, handler) {var this$0 = this; | |
if (this.instance) { | |
this.instance.registerHandler(address, handler) | |
// and return the deregister callback | |
var deconstructor = function() { | |
this$0.unregisterHandler(address, handler) | |
} | |
deconstructor.displayName = (("" + (CONSTANTS.MODULE)) + ("/" + (CONSTANTS.COMPONENT)) + ": EventBusStub.registerHandler (deconstructor)") | |
return deconstructor | |
} | |
}; | |
proto$0.unregisterHandler = function(address, handler) { | |
if (this.instance) { | |
return this.instance.unregisterHandler(address, handler) | |
} | |
}; | |
proto$0.readyState = function() { | |
if (this.instance) { | |
return this.instance.readyState() | |
} else { | |
return this.EventBus.CLOSED; | |
} | |
}; | |
proto$0.getOptions = function() { | |
// clone options | |
return angular.extend({}, this.options) | |
}; | |
MIXIN$0(ProxyEventbusWrapper.prototype,proto$0);proto$0=void 0;return ProxyEventbusWrapper;})(EventbusWrapper); | |
var SentinelEventbusWrapper = (function(super$0){"use strict";function SentinelEventbusWrapper() {if(super$0!==null)super$0.apply(this, arguments)}if(!PRS$0)MIXIN$0(SentinelEventbusWrapper, super$0);if(super$0!==null)SP$0(SentinelEventbusWrapper,super$0);SentinelEventbusWrapper.prototype = OC$0(super$0!==null?super$0.prototype:null,{"constructor":{"value":SentinelEventbusWrapper,"configurable":true,"writable":true}});DP$0(SentinelEventbusWrapper,"prototype",{"configurable":false,"enumerable":false,"writable":false});;return SentinelEventbusWrapper;})(EventbusWrapper); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.registerModule("src/vertxbus-wrapper.js", [], function() { | |
"use strict"; | |
var __moduleName = "src/vertxbus-wrapper.js"; | |
angular.module('knalli.angular-vertxbus').provider('vertxEventBus', function() { | |
var $__0 = this; | |
var CONSTANTS = { | |
MODULE: 'angular-vertxbus', | |
COMPONENT: 'wrapper' | |
}; | |
var DEFAULT_OPTIONS = { | |
enabled: true, | |
debugEnabled: false, | |
prefix: 'vertx-eventbus.', | |
urlServer: (location.protocol + "//" + location.hostname) + (((function() { | |
if (location.port) { | |
return (":" + location.port); | |
} | |
}))() || ''), | |
urlPath: '/eventbus', | |
reconnectEnabled: true, | |
sockjsStateInterval: 10000, | |
sockjsReconnectInterval: 10000, | |
sockjsOptions: {}, | |
messageBuffer: 0 | |
}; | |
var options = angular.extend({}, DEFAULT_OPTIONS); | |
this.enable = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.enabled; | |
options.enabled = (value === true); | |
return $__0; | |
}); | |
this.enable.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.enable"); | |
this.useDebug = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.debugEnabled; | |
options.debugEnabled = (value === true); | |
return $__0; | |
}); | |
this.useDebug.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useDebug"); | |
this.usePrefix = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.prefix; | |
options.prefix = value; | |
return $__0; | |
}); | |
this.usePrefix.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.usePrefix"); | |
this.useUrlServer = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.urlServer; | |
options.urlServer = value; | |
return $__0; | |
}); | |
this.useUrlServer.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useUrlServer"); | |
this.useUrlPath = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.urlPath; | |
options.urlPath = value; | |
return $__0; | |
}); | |
this.useUrlPath.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useUrlPath"); | |
this.useReconnect = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.reconnectEnabled; | |
options.reconnectEnabled = value; | |
return $__0; | |
}); | |
this.useReconnect.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useReconnect"); | |
this.useSockJsStateInterval = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.sockjsStateInterval; | |
options.sockjsStateInterval = value; | |
return $__0; | |
}); | |
this.useSockJsStateInterval.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useSockJsStateInterval"); | |
this.useSockJsReconnectInterval = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.sockjsReconnectInterval; | |
options.sockjsReconnectInterval = value; | |
return $__0; | |
}); | |
this.useSockJsReconnectInterval.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useSockJsReconnectInterval"); | |
this.useSockJsOptions = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.sockjsOptions; | |
options.sockjsOptions = value; | |
return $__0; | |
}); | |
this.useSockJsOptions.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useSockJsOptions"); | |
this.useMessageBuffer = (function() { | |
var value = arguments[0] !== (void 0) ? arguments[0] : DEFAULT_OPTIONS.messageBuffer; | |
options.messageBuffer = value; | |
return $__0; | |
}); | |
this.useMessageBuffer.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": provider.useMessageBuffer"); | |
this.$get = (function($timeout, $log) { | |
var $__3 = angular.extend({}, DEFAULT_OPTIONS, options), | |
enabled = $__3.enabled, | |
debugEnabled = $__3.debugEnabled, | |
prefix = $__3.prefix, | |
urlServer = $__3.urlServer, | |
urlPath = $__3.urlPath, | |
reconnectEnabled = $__3.reconnectEnabled, | |
sockjsStateInterval = $__3.sockjsStateInterval, | |
sockjsReconnectInterval = $__3.sockjsReconnectInterval, | |
sockjsOptions = $__3.sockjsOptions, | |
messageBuffer = $__3.messageBuffer; | |
if (enabled && vertx && vertx.EventBus) { | |
if (debugEnabled) { | |
$log.debug("[Vert.x EB Stub] Enabled"); | |
} | |
return new ProxyEventbusWrapper(vertx.EventBus, $timeout, $log, { | |
enabled: enabled, | |
debugEnabled: debugEnabled, | |
prefix: prefix, | |
urlServer: urlServer, | |
urlPath: urlPath, | |
reconnectEnabled: reconnectEnabled, | |
sockjsStateInterval: sockjsStateInterval, | |
sockjsReconnectInterval: sockjsReconnectInterval, | |
sockjsOptions: sockjsOptions, | |
messageBuffer: messageBuffer | |
}); | |
} else { | |
if (debugEnabled) { | |
$log.debug("[Vert.x EB Stub] Disabled"); | |
} | |
return new SentinelEventbusWrapper(); | |
} | |
}); | |
var EventbusWrapper = function EventbusWrapper() {}; | |
($traceurRuntime.createClass)(EventbusWrapper, { | |
connect: function() {}, | |
reconnect: function() {}, | |
close: function() {}, | |
login: function(username, password, replyHandler) {}, | |
send: function(address, message, replyHandler) {}, | |
publish: function(address, message) {}, | |
registerHandler: function(address, handler) {}, | |
unregisterHandler: function(address, handler) {}, | |
readyState: function() {}, | |
getOptions: function() { | |
return {}; | |
}, | |
onopen: function() {}, | |
onclose: function() {} | |
}, {}); | |
var ProxyEventbusWrapper = function ProxyEventbusWrapper(EventBus, $timeout, $log, $__3) { | |
var $__4 = $__3, | |
enabled = $__4.enabled, | |
debugEnabled = $__4.debugEnabled, | |
prefix = $__4.prefix, | |
urlServer = $__4.urlServer, | |
urlPath = $__4.urlPath, | |
reconnectEnabled = $__4.reconnectEnabled, | |
sockjsStateInterval = $__4.sockjsStateInterval, | |
sockjsReconnectInterval = $__4.sockjsReconnectInterval, | |
sockjsOptions = $__4.sockjsOptions, | |
messageBuffer = $__4.messageBuffer; | |
$traceurRuntime.superConstructor($ProxyEventbusWrapper).call(this); | |
this.EventBus = EventBus; | |
this.$timeout = $timeout; | |
this.$log = $log; | |
this.options = { | |
enabled: enabled, | |
debugEnabled: debugEnabled, | |
prefix: prefix, | |
urlServer: urlServer, | |
urlPath: urlPath, | |
reconnectEnabled: reconnectEnabled, | |
sockjsStateInterval: sockjsStateInterval, | |
sockjsReconnectInterval: sockjsReconnectInterval, | |
sockjsOptions: sockjsOptions, | |
messageBuffer: messageBuffer | |
}; | |
this.connect(); | |
}; | |
var $ProxyEventbusWrapper = ProxyEventbusWrapper; | |
($traceurRuntime.createClass)(ProxyEventbusWrapper, { | |
connect: function() { | |
var $__1 = this; | |
var url = ("" + this.options.urlServer + this.options.urlPath); | |
if (this.options.debugEnabled) { | |
this.$log.debug(("[Vert.x EB Stub] Enabled: connecting '" + url + "'")); | |
} | |
this.instance = new this.EventBus(url, undefined, this.options.sockjsOptions); | |
this.instance.onopen = (function() { | |
if ($__1.options.debugEnabled) { | |
$__1.$log.debug("[Vert.x EB Stub] Connected"); | |
} | |
if (angular.isFunction($__1.onopen)) { | |
$__1.onopen(); | |
} | |
}); | |
this.instance.onclose = (function() { | |
if ($__1.options.debugEnabled) { | |
$__1.$log.debug(("[Vert.x EB Stub] Reconnect in " + $__1.options.sockjsReconnectInterval + "ms")); | |
} | |
if (angular.isFunction($__1.onclose)) { | |
$__1.onclose(); | |
} | |
$__1.instance = undefined; | |
if ($__1.options.reconnectEnabled) { | |
$__1.$timeout(((function() { | |
return $__1.connect(); | |
})), $__1.options.sockjsReconnectInterval); | |
} | |
}); | |
}, | |
reconnect: function() { | |
if (this.instance) { | |
return this.instance.close(); | |
} | |
}, | |
close: function() { | |
if (this.instance) { | |
return this.instance.close(); | |
} | |
}, | |
login: function(username, password, replyHandler) { | |
if (this.instance) { | |
return this.instance.login(username, password, replyHandler); | |
} | |
}, | |
send: function(address, message, replyHandler) { | |
if (this.instance) { | |
return this.instance.send(address, message, replyHandler); | |
} | |
}, | |
publish: function(address, message) { | |
if (this.instance) { | |
return this.instance.publish(address, message); | |
} | |
}, | |
registerHandler: function(address, handler) { | |
var $__1 = this; | |
if (this.instance) { | |
this.instance.registerHandler(address, handler); | |
var deconstructor = (function() { | |
$__1.unregisterHandler(address, handler); | |
}); | |
deconstructor.displayName = (CONSTANTS.MODULE + "/" + CONSTANTS.COMPONENT + ": EventBusStub.registerHandler (deconstructor)"); | |
return deconstructor; | |
} | |
}, | |
unregisterHandler: function(address, handler) { | |
if (this.instance) { | |
return this.instance.unregisterHandler(address, handler); | |
} | |
}, | |
readyState: function() { | |
if (this.instance) { | |
return this.instance.readyState(); | |
} else { | |
return this.EventBus.CLOSED; | |
} | |
}, | |
getOptions: function() { | |
return angular.extend({}, this.options); | |
} | |
}, {}, EventbusWrapper); | |
var SentinelEventbusWrapper = function SentinelEventbusWrapper() { | |
$traceurRuntime.superConstructor($SentinelEventbusWrapper).apply(this, arguments); | |
; | |
}; | |
var $SentinelEventbusWrapper = SentinelEventbusWrapper; | |
($traceurRuntime.createClass)(SentinelEventbusWrapper, {}, {}, EventbusWrapper); | |
}); | |
return {}; | |
}); | |
//# sourceURL=src/vertxbus-wrapper.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment