mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-22 04:24:09 +00:00
Add method to clear mutation listeners in RPC client
This commit is contained in:
parent
e86dc94ee9
commit
358e5dacf3
@ -125,7 +125,10 @@ Object.defineProperties(Realm, {
|
||||
set: util.setterForProperty('defaultPath'),
|
||||
},
|
||||
clearTestState: {
|
||||
value: rpc.clearTestState,
|
||||
value: function() {
|
||||
util.clearMutationListeners();
|
||||
rpc.clearTestState();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user