|
@@ -124,9 +124,23 @@ define([
|
|
|
|
|
|
Observable.prototype.trigger = function (event) {
|
|
Observable.prototype.trigger = function (event) {
|
|
var slice = Array.prototype.slice;
|
|
var slice = Array.prototype.slice;
|
|
|
|
+ var params = slice.call(arguments, 1);
|
|
|
|
|
|
this.listeners = this.listeners || {};
|
|
this.listeners = this.listeners || {};
|
|
|
|
|
|
|
|
+ // Params should always come in as an array
|
|
|
|
+ if (params == null) {
|
|
|
|
+ params = [];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // If there are no arguments to the event, use a temporary object
|
|
|
|
+ if (params.length === 0) {
|
|
|
|
+ params.push({});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Set the `_type` of the first object to the event
|
|
|
|
+ params[0]._type = event;
|
|
|
|
+
|
|
if (event in this.listeners) {
|
|
if (event in this.listeners) {
|
|
this.invoke(this.listeners[event], slice.call(arguments, 1));
|
|
this.invoke(this.listeners[event], slice.call(arguments, 1));
|
|
}
|
|
}
|