mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-10 22:36:01 +00:00
Remove uses of for-of loops in RPC modules
The React Native packager does not transform for-of loops, and minification step uses UglifyJS, which does not yet support ES6 syntax. Fixes #120
This commit is contained in:
parent
54b94b6afa
commit
336ef55c1f
@ -4,6 +4,9 @@
|
|||||||
"browser": true,
|
"browser": true,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
},
|
},
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"forOf": false
|
||||||
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"global": true
|
"global": true
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,14 @@ function create(realmId, info) {
|
|||||||
object[keys.id] = info.id;
|
object[keys.id] = info.id;
|
||||||
object[keys.type] = info.type;
|
object[keys.type] = info.type;
|
||||||
|
|
||||||
for (let prop of schema.properties) {
|
schema.properties.forEach((prop) => {
|
||||||
let name = prop.name;
|
let name = prop.name;
|
||||||
|
|
||||||
props[name] = {
|
props[name] = {
|
||||||
get: util.getterForProperty(name),
|
get: util.getterForProperty(name),
|
||||||
set: util.setterForProperty(name),
|
set: util.setterForProperty(name),
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
|
|
||||||
Object.defineProperties(object, props);
|
Object.defineProperties(object, props);
|
||||||
|
|
||||||
|
@ -101,9 +101,7 @@ class Realm {
|
|||||||
|
|
||||||
rpc.commitTransaction(realmId);
|
rpc.commitTransaction(realmId);
|
||||||
|
|
||||||
for (let callback of this[listenersKey]) {
|
this[listenersKey].forEach((cb) => cb(this, 'change'));
|
||||||
callback(this, 'change');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,9 +28,7 @@ function addMutationListener(realmId, callback) {
|
|||||||
function fireMutationListeners(realmId) {
|
function fireMutationListeners(realmId) {
|
||||||
let listeners = mutationListeners[realmId];
|
let listeners = mutationListeners[realmId];
|
||||||
if (listeners) {
|
if (listeners) {
|
||||||
for (let callback of listeners) {
|
listeners.forEach((cb) => cb());
|
||||||
callback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,11 +95,11 @@ function createList(prototype, realmId, info, mutable) {
|
|||||||
function createMethods(prototype, type, methodNames, mutates) {
|
function createMethods(prototype, type, methodNames, mutates) {
|
||||||
let props = {};
|
let props = {};
|
||||||
|
|
||||||
for (let name of methodNames) {
|
methodNames.forEach((name) => {
|
||||||
props[name] = {
|
props[name] = {
|
||||||
value: createMethod(type, name, mutates),
|
value: createMethod(type, name, mutates),
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
|
|
||||||
Object.defineProperties(prototype, props);
|
Object.defineProperties(prototype, props);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user