Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Mar 22, 2016
1 parent 05d1f62 commit c787813
Show file tree
Hide file tree
Showing 13 changed files with 155 additions and 271 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-event-aggregator",
"version": "1.0.0-beta.1.1.1",
"version": "1.0.0-beta.1.2.0",
"description": "A lightweight pub/sub messaging system for app-wide or per-object loosely coupled events.",
"keywords": [
"aurelia",
Expand Down
7 changes: 3 additions & 4 deletions dist/amd/aurelia-event-aggregator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ declare module 'aurelia-event-aggregator' {
*/
dispose(): void;
}
class Handler {
constructor(messageType: any, callback: any);
handle(message: any): any;
}

/**
* Enables loosely coupled publish/subscribe messaging.
*/
/**
* Enables loosely coupled publish/subscribe messaging.
*/
Expand Down
50 changes: 37 additions & 13 deletions dist/amd/aurelia-event-aggregator.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
define(['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
'use strict';

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.EventAggregator = undefined;
exports.includeEventsIn = includeEventsIn;
exports.configure = configure;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var LogManager = _interopRequireWildcard(_aureliaLogging);

var logger = _aureliaLogging.getLogger('event-aggregator');
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};

var Handler = (function () {
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
}
}

newObj.default = obj;
return newObj;
}
}

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}

var logger = LogManager.getLogger('event-aggregator');

var Handler = function () {
function Handler(messageType, callback) {
_classCallCheck(this, Handler);

Expand All @@ -24,9 +50,9 @@ define(['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
};

return Handler;
})();
}();

var EventAggregator = (function () {
var EventAggregator = exports.EventAggregator = function () {
function EventAggregator() {
_classCallCheck(this, EventAggregator);

Expand All @@ -35,8 +61,8 @@ define(['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
}

EventAggregator.prototype.publish = function publish(event, data) {
var subscribers = undefined;
var i = undefined;
var subscribers = void 0;
var i = void 0;

if (!event) {
throw new Error('Event was invalid.');
Expand Down Expand Up @@ -71,8 +97,8 @@ define(['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
};

EventAggregator.prototype.subscribe = function subscribe(event, callback) {
var handler = undefined;
var subscribers = undefined;
var handler = void 0;
var subscribers = void 0;

if (!event) {
throw new Error('Event channel/type was invalid.');
Expand Down Expand Up @@ -108,9 +134,7 @@ define(['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
};

return EventAggregator;
})();

exports.EventAggregator = EventAggregator;
}();

function includeEventsIn(obj) {
var ea = new EventAggregator();
Expand Down
7 changes: 3 additions & 4 deletions dist/aurelia-event-aggregator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ declare module 'aurelia-event-aggregator' {
*/
dispose(): void;
}
class Handler {
constructor(messageType: any, callback: any);
handle(message: any): any;
}

/**
* Enables loosely coupled publish/subscribe messaging.
*/
/**
* Enables loosely coupled publish/subscribe messaging.
*/
Expand Down
7 changes: 3 additions & 4 deletions dist/commonjs/aurelia-event-aggregator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ declare module 'aurelia-event-aggregator' {
*/
dispose(): void;
}
class Handler {
constructor(messageType: any, callback: any);
handle(message: any): any;
}

/**
* Enables loosely coupled publish/subscribe messaging.
*/
/**
* Enables loosely coupled publish/subscribe messaging.
*/
Expand Down
31 changes: 16 additions & 15 deletions dist/commonjs/aurelia-event-aggregator.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
'use strict';

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.EventAggregator = undefined;
exports.includeEventsIn = includeEventsIn;
exports.configure = configure;

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var _aureliaLogging = require('aurelia-logging');

var LogManager = _interopRequireWildcard(_aureliaLogging);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var logger = LogManager.getLogger('event-aggregator');

var Handler = (function () {
var Handler = function () {
function Handler(messageType, callback) {
_classCallCheck(this, Handler);

Expand All @@ -29,9 +32,9 @@ var Handler = (function () {
};

return Handler;
})();
}();

var EventAggregator = (function () {
var EventAggregator = exports.EventAggregator = function () {
function EventAggregator() {
_classCallCheck(this, EventAggregator);

Expand All @@ -40,8 +43,8 @@ var EventAggregator = (function () {
}

EventAggregator.prototype.publish = function publish(event, data) {
var subscribers = undefined;
var i = undefined;
var subscribers = void 0;
var i = void 0;

if (!event) {
throw new Error('Event was invalid.');
Expand Down Expand Up @@ -76,8 +79,8 @@ var EventAggregator = (function () {
};

EventAggregator.prototype.subscribe = function subscribe(event, callback) {
var handler = undefined;
var subscribers = undefined;
var handler = void 0;
var subscribers = void 0;

if (!event) {
throw new Error('Event channel/type was invalid.');
Expand Down Expand Up @@ -113,9 +116,7 @@ var EventAggregator = (function () {
};

return EventAggregator;
})();

exports.EventAggregator = EventAggregator;
}();

function includeEventsIn(obj) {
var ea = new EventAggregator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ declare module 'aurelia-event-aggregator' {
*/
dispose(): void;
}
class Handler {
constructor(messageType: any, callback: any);
handle(message: any): any;
}

/**
* Enables loosely coupled publish/subscribe messaging.
*/
/**
* Enables loosely coupled publish/subscribe messaging.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as LogManager from 'aurelia-logging';

const logger = LogManager.getLogger('event-aggregator');

class Handler {
let Handler = class Handler {
constructor(messageType, callback) {
this.messageType = messageType;
this.callback = callback;
Expand All @@ -13,36 +13,15 @@ class Handler {
this.callback.call(null, message);
}
}
}

/**
* Represents a disposable subsciption to an EventAggregator event.
*/
interface Subscription {
/**
* Disposes the subscription.
*/
dispose(): void;
}
};

/**
* Enables loosely coupled publish/subscribe messaging.
*/
export class EventAggregator {
/**
* Creates an instance of the EventAggregator class.
*/
export let EventAggregator = class EventAggregator {
constructor() {
this.eventLookup = {};
this.messageHandlers = [];
}

/**
* Publishes a message.
* @param event The event or channel to publish to.
* @param data The data to publish on the channel.
*/
publish(event: string | any, data?: any): void {
publish(event, data) {
let subscribers;
let i;

Expand Down Expand Up @@ -78,12 +57,7 @@ export class EventAggregator {
}
}

/**
* Subscribes to a message channel or message type.
* @param event The event channel or event data type.
* @param callback The callback to be invoked when when the specified message is published.
*/
subscribe(event: string | Function, callback: Function): Subscription {
subscribe(event, callback) {
let handler;
let subscribers;

Expand Down Expand Up @@ -111,47 +85,34 @@ export class EventAggregator {
};
}

/**
* Subscribes to a message channel or message type, then disposes the subscription automatically after the first message is received.
* @param event The event channel or event data type.
* @param callback The callback to be invoked when when the specified message is published.
*/
subscribeOnce(event: string | Function, callback: Function): Subscription {
subscribeOnce(event, callback) {
let sub = this.subscribe(event, (a, b) => {
sub.dispose();
return callback(a, b);
});

return sub;
}
}
};

/**
* Includes EA functionality into an object instance.
* @param obj The object to mix Event Aggregator functionality into.
*/
export function includeEventsIn(obj: Object): EventAggregator {
export function includeEventsIn(obj) {
let ea = new EventAggregator();

obj.subscribeOnce = function(event, callback) {
obj.subscribeOnce = function (event, callback) {
return ea.subscribeOnce(event, callback);
};

obj.subscribe = function(event, callback) {
obj.subscribe = function (event, callback) {
return ea.subscribe(event, callback);
};

obj.publish = function(event, data) {
obj.publish = function (event, data) {
ea.publish(event, data);
};

return ea;
}

/**
* Configures a global EA by merging functionality into the Aurelia instance.
* @param config The Aurelia Framework configuration object used to configure the plugin.
*/
export function configure(config: Object): void {
export function configure(config) {
config.instance(EventAggregator, includeEventsIn(config.aurelia));
}
}
7 changes: 3 additions & 4 deletions dist/system/aurelia-event-aggregator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ declare module 'aurelia-event-aggregator' {
*/
dispose(): void;
}
class Handler {
constructor(messageType: any, callback: any);
handle(message: any): any;
}

/**
* Enables loosely coupled publish/subscribe messaging.
*/
/**
* Enables loosely coupled publish/subscribe messaging.
*/
Expand Down
Loading

0 comments on commit c787813

Please sign in to comment.