|
|
@@ -439,8 +439,9 @@ exports.setDefaults = function (newDefaults) {
|
|
|
* @return [ Void ]
|
|
|
*/
|
|
|
exports.on = function (event, callback, scope) {
|
|
|
+ var type = typeof callback;
|
|
|
|
|
|
- if (typeof callback !== "function")
|
|
|
+ if (type !== 'function' && type !== 'string')
|
|
|
return;
|
|
|
|
|
|
if (!this._listener[event]) {
|
|
|
@@ -499,6 +500,10 @@ exports.fireEvent = function (event) {
|
|
|
var fn = listener[i][0],
|
|
|
scope = listener[i][1];
|
|
|
|
|
|
+ if (typeof fn !== 'function') {
|
|
|
+ fn = scope[fn];
|
|
|
+ }
|
|
|
+
|
|
|
fn.apply(scope, args);
|
|
|
}
|
|
|
};
|