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