event emitter uses keystring instead of key, to avoid broadcasting to all domainObjects that share the same key' (#2350)

This commit is contained in:
Deep Tailor 2019-04-04 10:29:42 -07:00 committed by Pegah Sarram
parent 97ccaa58c7
commit 4189a05758
2 changed files with 9 additions and 3 deletions

View File

@ -57,8 +57,10 @@ define([
}.bind(this);
handleLegacyMutation = function (legacyObject) {
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId());
this.eventEmitter.emit(newStyleObject.identifier.key + ":*", newStyleObject);
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId()),
keystring = utils.makeKeyString(newStyleObject.identifier);
this.eventEmitter.emit(keystring + ":*", newStyleObject);
this.eventEmitter.emit('mutation', newStyleObject);
}.bind(this);

View File

@ -21,8 +21,10 @@
*****************************************************************************/
define([
'./object-utils.js',
'lodash'
], function (
utils,
_
) {
var ANY_OBJECT_EVENT = "mutation";
@ -41,7 +43,9 @@ define([
}
function qualifiedEventName(object, eventName) {
return [object.identifier.key, eventName].join(':');
var keystring = utils.makeKeyString(object.identifier);
return [keystring, eventName].join(':');
}
MutableObject.prototype.stopListening = function () {