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:
parent
17f1b3e53e
commit
695825c50b
@ -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) {
|
||||
|
@ -41,6 +41,7 @@ describe("EventListener", () => {
|
||||
assert(events)
|
||||
assert(events.length === 2)
|
||||
done()
|
||||
EventListener.unsubscribe(event)
|
||||
})
|
||||
|
||||
const {market} = keeper
|
||||
|
@ -41,6 +41,7 @@ describe("EventListener", () => {
|
||||
const countAfter = EventListener.count()
|
||||
assert(countBefore + 1 === countAfter, `${countBefore}${countAfter}`)
|
||||
|
||||
EventListener.unsubscribe(event)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user