Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

Commit

Permalink
Release 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
knalli committed Nov 23, 2014
1 parent 8333a1c commit 7c0a3ac
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 41 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
<a name="v0.9.0"></a>
## v0.9.0 (2014-11-23)


#### Bug Fixes

* **package:** use non minified artifact as 'main' ([72b51654](http://github.com/knalli/angular-vertxbus/commit/72b51654618d6d3e0519845b2a8f35c83b7e9c98), closes [#27](http://github.com/knalli/angular-vertxbus/issues/27))


#### Features

* improve debugger-readibility w/ fn.displayName ([8e5006e7](http://github.com/knalli/angular-vertxbus/commit/8e5006e73ac0bc6d1157ffc4d7d2334ac7b2df4a))
* **componentjs:**
* add support for componentjs and related builds ([9a763d6f](http://github.com/knalli/angular-vertxbus/commit/9a763d6f90ba2633cae8510e1f0370128b4c7b0b)) ([d748944d](http://github.com/knalli/angular-vertxbus/commit/d748944dae9e10c5332f046904f8a4ee331e6125)) ([2755038e](http://github.com/knalli/angular-vertxbus/commit/2755038ee618f939ee58d78e5cc7642072eb1297))


#### Breaking Changes

* The bower dependency for SockJS has been changed from 'sockjs' to 'sockjs-client' officially supported since https://github.com/sockjs/sockjs-client/commit/3cbe21423e7f2c93f4b6853059f38ae1a7b2a2b2
([86b06b6d](http://github.com/knalli/angular-vertxbus/commit/86b06b6d583353965f74bacf2a7995c9830e474d))

<a name="v0.8.1"></a>
### v0.8.1 (2014-10-30)

Expand Down
94 changes: 74 additions & 20 deletions dist/angular-vertxbus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! angular-vertxbus - v0.8.1 - 2014-10-30
/*! angular-vertxbus - v0.9.0 - 2014-11-23
* http://github.com/knalli/angular-vertxbus
* Copyright (c) 2014 ; Licensed */
(function () {
Expand All @@ -18,7 +18,11 @@
* sockjsOptions (default {}): optional SockJS options (new SockJS(url, undefined, options))
*/
angular.module('knalli.angular-vertxbus').provider('vertxEventBus', function () {
var DEFAULT_OPTIONS, options;
var CONSTANTS, DEFAULT_OPTIONS, options;
CONSTANTS = {
MODULE: 'angular-vertxbus',
COMPONENT: 'wrapper'
};
DEFAULT_OPTIONS = {
enabled: true,
debugEnabled: false,
Expand Down Expand Up @@ -173,11 +177,14 @@
return eventBus.publish(address, message);
},
registerHandler: function (address, handler) {
var deconstructor;
eventBus.registerHandler(address, handler);
/* and return the deregister callback*/
return function () {
deconstructor = function () {
stub.unregisterHandler(address, handler);
};
deconstructor.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.registerHandler (deconstructor)';
return deconstructor;
},
unregisterHandler: function (address, handler) {
return eventBus.unregisterHandler(address, handler);
Expand All @@ -190,6 +197,15 @@
return angular.extend({}, options);
}
};
stub.reconnect.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.reconnect';
stub.close.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.close';
stub.login.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.login';
stub.send.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.send';
stub.publish.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.publish';
stub.registerHandler.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.registerHandler';
stub.unregisterHandler.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.unregisterHandler';
stub.readyState.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.readyState';
stub.getOptions.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': EventBusWrapper.getOptions';
} else {
if (debugEnabled) {
console.debug('[VertX EventBus] Disabled');
Expand All @@ -198,6 +214,7 @@
return stub;
}
];
this.$get.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': initializer';
});
/*
A service utilitzing an underlaying Vertx Event Bus
Expand All @@ -219,7 +236,11 @@
Note the additional configuration of the module itself.
*/
angular.module('knalli.angular-vertxbus').provider('vertxEventBusService', function () {
var DEFAULT_OPTIONS, MessageQueueHolder, SimpleMap, options;
var CONSTANTS, DEFAULT_OPTIONS, MessageQueueHolder, SimpleMap, options;
CONSTANTS = {
MODULE: 'angular-vertxbus',
COMPONENT: 'service'
};
DEFAULT_OPTIONS = {
loginRequired: false,
loginBlockForSession: false,
Expand Down Expand Up @@ -333,28 +354,31 @@
options.loginRequired = value;
return this;
};
this.requireLogin.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': requireLogin';
this.blockForSession = function (value) {
if (value == null) {
value = options.loginBlockForSession;
}
options.loginBlockForSession = value;
return this;
};
this.blockForSession.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': blockForSession';
this.skipUnauthorizeds = function (value) {
if (value == null) {
value = options.skipUnauthorizeds;
}
options.skipUnauthorizeds = value;
return this;
};
this.skipUnauthorizeds.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': skipUnauthorizeds';
this.$get = [
'$rootScope',
'$q',
'$interval',
'$timeout',
'vertxEventBus',
function ($rootScope, $q, $interval, $timeout, vertxEventBus) {
var connectionState, debugEnabled, enabled, ensureOpenAuthConnection, ensureOpenConnection, fnWrapperMap, loginPromise, messageBuffer, messageQueueHolder, prefix, reconnectEnabled, sockjsOptions, sockjsReconnectInterval, sockjsStateInterval, urlPath, urlServer, util, validSession, wrapped, _ref, _ref1;
var connectionIntervalCheck, connectionState, debugEnabled, enabled, ensureOpenAuthConnection, ensureOpenConnection, fnWrapperMap, loginPromise, messageBuffer, messageQueueHolder, prefix, reconnectEnabled, sockjsOptions, sockjsReconnectInterval, sockjsStateInterval, urlPath, urlServer, util, validSession, wrapped, _ref, _ref1;
_ref = (vertxEventBus != null ? vertxEventBus.getOptions() : void 0) || {}, enabled = _ref.enabled, debugEnabled = _ref.debugEnabled, prefix = _ref.prefix, urlServer = _ref.urlServer, urlPath = _ref.urlPath, reconnectEnabled = _ref.reconnectEnabled, sockjsStateInterval = _ref.sockjsStateInterval, sockjsReconnectInterval = _ref.sockjsReconnectInterval, sockjsOptions = _ref.sockjsOptions, messageBuffer = _ref.messageBuffer;
connectionState = vertxEventBus != null ? (_ref1 = vertxEventBus.EventBus) != null ? _ref1.CLOSED : void 0 : void 0;
validSession = false;
Expand Down Expand Up @@ -391,6 +415,7 @@
wrapped.getConnectionState(true);
return $rootScope.$broadcast('' + prefix + 'system.disconnected');
};
vertxEventBus.onclose.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': \'onclose\' handler';
}
ensureOpenConnection = function (fn) {
if (wrapped.getConnectionState() === vertxEventBus.EventBus.OPEN) {
Expand All @@ -402,11 +427,13 @@
}
return false;
};
ensureOpenConnection.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': ensureOpenConnection';
ensureOpenAuthConnection = function (fn) {
var wrapFn;
if (!options.loginRequired) {
return ensureOpenConnection(fn);
} else {
return ensureOpenConnection(function () {
wrapFn = function () {
if (validSession) {
fn();
return true;
Expand All @@ -416,11 +443,15 @@
}
return false;
}
});
};
wrapFn.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': ensureOpenAuthConnection function wrapper';
return ensureOpenConnection(wrapFn);
}
};
ensureOpenAuthConnection.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': ensureOpenAuthConnection';
util = {
registerHandler: function (address, callback) {
var deconstructor;
if (typeof callback !== 'function') {
return;
}
Expand All @@ -430,10 +461,12 @@
if (fnWrapperMap.containsKey(callback)) {
return fnWrapperMap.get(callback);
}
fnWrapperMap.put(callback, function (message, replyTo) {
deconstructor = function (message, replyTo) {
callback(message, replyTo);
return $rootScope.$digest();
});
};
deconstructor.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.registerHandler (deconstructor)';
fnWrapperMap.put(callback, deconstructor);
return vertxEventBus.registerHandler(address, fnWrapperMap.get(callback));
},
unregisterHandler: function (address, callback) {
Expand All @@ -447,12 +480,12 @@
fnWrapperMap.remove(callback);
},
send: function (address, message, timeout) {
var deferred, dispatched;
var deferred, dispatched, next;
if (timeout == null) {
timeout = 10000;
}
deferred = $q.defer();
dispatched = ensureOpenAuthConnection(function () {
next = function () {
vertxEventBus.send(address, message, function (reply) {
if (deferred) {
return deferred.resolve(reply);
Expand All @@ -463,40 +496,51 @@
return deferred.reject();
}, timeout);
}
});
};
next.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.send (ensureOpenAuthConnection callback)';
dispatched = ensureOpenAuthConnection(next);
if (deferred && !dispatched) {
deferred.reject();
}
return deferred != null ? deferred.promise : void 0;
},
publish: function (address, message) {
var dispatched;
dispatched = ensureOpenAuthConnection(function () {
var dispatched, next;
next = function () {
return vertxEventBus.publish(address, message);
});
};
next.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.publish (ensureOpenAuthConnection callback)';
dispatched = ensureOpenAuthConnection(next);
return dispatched;
},
login: function (username, password, timeout) {
var deferred;
var deferred, next;
if (timeout == null) {
timeout = 5000;
}
deferred = $q.defer();
vertxEventBus.login(username, password, function (reply) {
next = function (reply) {
if ((reply != null ? reply.status : void 0) === 'ok') {
deferred.resolve(reply);
return $rootScope.$broadcast('' + prefix + 'system.login.succeeded', { status: reply != null ? reply.status : void 0 });
} else {
deferred.reject(reply);
return $rootScope.$broadcast('' + prefix + 'system.login.failed', { status: reply != null ? reply.status : void 0 });
}
});
};
next.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.login (callback)';
vertxEventBus.login(username, password, next);
$timeout(function () {
return deferred.reject();
}, timeout);
return deferred.promise;
}
};
util.registerHandler.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.registerHandler';
util.unregisterHandler.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.unregisterHandler';
util.send.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.send';
util.publish.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.publish';
util.login.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': util.login';
wrapped = {
handlers: {},
registerHandler: function (address, callback) {
Expand Down Expand Up @@ -571,9 +615,18 @@
});
}
};
$interval(function () {
wrapped.registerHandler.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': wrapped.registerHandler';
wrapped.unregisterHandler.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': wrapped.unregisterHandler';
wrapped.send.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': wrapped.send';
wrapped.publish.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': wrapped.publish';
wrapped.getConnectionState.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': wrapped.getConnectionState';
wrapped.isValidSession.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': wrapped.isValidSession';
wrapped.login.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': wrapped.login';
connectionIntervalCheck = function () {
return wrapped.getConnectionState(true);
}, sockjsStateInterval);
};
connectionIntervalCheck.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': periodic connection check';
$interval(connectionIntervalCheck, sockjsStateInterval);
/* building and exposing the actual service API*/
return {
on: wrapped.registerHandler,
Expand All @@ -597,5 +650,6 @@
};
}
];
this.$get.displayName = '' + CONSTANTS.MODULE + '/' + CONSTANTS.COMPONENT + ': initializer';
});
}.call(this));
Loading

0 comments on commit 7c0a3ac

Please sign in to comment.