Merge pull request #7 from status-im/avoid_duplicate_updates
only trigger property watcher when value actually changes
This commit is contained in:
commit
bb335aa4cb
|
@ -1,5 +1,5 @@
|
|||
const { fromEvent, interval, ReplaySubject } = require('rxjs');
|
||||
const { throttle, filter } = require('rxjs/operators');
|
||||
const { throttle, filter, distinctUntilChanged } = require('rxjs/operators');
|
||||
const loki = require('lokijs')
|
||||
const Events = require('events')
|
||||
|
||||
|
@ -164,8 +164,7 @@ class EventSyncer {
|
|||
}])
|
||||
})
|
||||
|
||||
// TODO: add distinctUntilChanged
|
||||
return sub;
|
||||
return sub.pipe(distinctUntilChanged());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -151,6 +151,12 @@ async function run() {
|
|||
await SimpleStorageContract.methods.set(100).send({ from: accounts[0], gas: 4700000 })
|
||||
console.dir("set 200")
|
||||
await SimpleStorageContract.methods.set2(200).send({ from: accounts[0] })
|
||||
console.dir("set 200")
|
||||
await SimpleStorageContract.methods.set2(200).send({ from: accounts[0] })
|
||||
console.dir("set 300")
|
||||
await SimpleStorageContract.methods.set(300).send({ from: accounts[0] })
|
||||
console.dir("set 300")
|
||||
await SimpleStorageContract.methods.set(300).send({ from: accounts[0] })
|
||||
console.dir("set 300")
|
||||
await SimpleStorageContract.methods.set(300).send({ from: accounts[0] })
|
||||
|
||||
|
|
Loading…
Reference in New Issue