mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Assume that Emiter#_evenTypes is not always defined.
Resolves https://github.com/paperjs/paper.js/pull/674#discussion_r30042363
This commit is contained in:
parent
75c6db6986
commit
6b428f5a37
1 changed files with 6 additions and 3 deletions
|
@ -23,7 +23,8 @@ var Emitter = {
|
|||
this.on(key, value);
|
||||
}, this);
|
||||
} else {
|
||||
var entry = this._eventTypes[type],
|
||||
var types = this._eventTypes,
|
||||
entry = types && types[type],
|
||||
handlers = this._callbacks = this._callbacks || {};
|
||||
handlers = handlers[type] = handlers[type] || [];
|
||||
if (handlers.indexOf(func) === -1) { // Not added yet, add now.
|
||||
|
@ -45,7 +46,8 @@ var Emitter = {
|
|||
}, this);
|
||||
return;
|
||||
}
|
||||
var entry = this._eventTypes[type],
|
||||
var types = this._eventTypes,
|
||||
entry = types && types[type],
|
||||
handlers = this._callbacks && this._callbacks[type],
|
||||
index;
|
||||
if (handlers) {
|
||||
|
@ -103,7 +105,8 @@ var Emitter = {
|
|||
key = install ? 'install' : 'uninstall';
|
||||
for (var type in handlers) {
|
||||
if (handlers[type].length > 0) {
|
||||
var entry = this._eventTypes[type],
|
||||
var types = this._eventTypes,
|
||||
entry = types && types[type],
|
||||
func = entry && entry[key];
|
||||
if (func)
|
||||
func.call(this, type);
|
||||
|
|
Loading…
Reference in a new issue