Open bugs181 opened 5 years ago
Since iterables use the flow mechanism, it would be possible to also write an iterateOn
addition.
iterate
Example:
let users = Gun.from(“users”).iterate // Assume [1, 2, 3]
for (let user of users) {
// Do something with user
}
iterateOn
Example:
let users = Gun.from(“users”).iterateOn // Assume default [1, 2, 3] and add: [4]
for (let user of users) { // First trigger would be [1, 2, 3]
// Do something with user
}
users.push(4) // triggers above loop with [4]
Example: