1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

fix unsubscribe

This commit is contained in:
Sebastian Gerske 2018-11-23 14:54:22 +01:00
parent 17f1b3e53e
commit 695825c50b
3 changed files with 5 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import Web3Provider from "./Web3Provider"
export default class Event {
private poller
private poller = null
private lastBlock: number = 0
private interval: number = 200
@ -15,7 +15,8 @@ export default class Event {
}
public stopListen() {
clearTimeout(this.poller)
clearInterval(this.poller)
this.poller = null
}
public async listen(callback: any) {

View File

@ -41,6 +41,7 @@ describe("EventListener", () => {
assert(events)
assert(events.length === 2)
done()
EventListener.unsubscribe(event)
})
const {market} = keeper

View File

@ -41,6 +41,7 @@ describe("EventListener", () => {
const countAfter = EventListener.count()
assert(countBefore + 1 === countAfter, `${countBefore}${countAfter}`)
EventListener.unsubscribe(event)
done()
})
})