Add method to clear mutation listeners in RPC client

This commit is contained in:
Scott Kyle 2015-11-02 16:29:13 -08:00
parent e86dc94ee9
commit 358e5dacf3
2 changed files with 10 additions and 2 deletions

View File

@ -125,7 +125,10 @@ Object.defineProperties(Realm, {
set: util.setterForProperty('defaultPath'),
},
clearTestState: {
value: rpc.clearTestState,
value: function() {
util.clearMutationListeners();
rpc.clearTestState();
},
},
});

View File

@ -8,9 +8,10 @@ const constants = require('./constants');
const rpc = require('./rpc');
const {keys} = constants;
const mutationListeners = {};
let mutationListeners = {};
module.exports = {
clearMutationListeners,
fireMutationListeners,
createList,
createMethods,
@ -31,6 +32,10 @@ function removeMutationListener(realmId, callback) {
}
}
function clearMutationListeners() {
mutationListeners = {};
}
function fireMutationListeners(realmId) {
let listeners = mutationListeners[realmId];
if (listeners) {