mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
chore: use cancel in one time listener
This commit is contained in:
parent
a01a7ede9e
commit
b0dcb256a7
1 changed files with 3 additions and 2 deletions
|
|
@ -351,10 +351,11 @@ export class VisibleNodesGenerator extends FlattenLayer {
|
|||
|
||||
onNextUpdate(callback: (visibleNodes: VisibleNodes) => void) {
|
||||
const oneTimeSubscription = (visibleNodes: VisibleNodes) => {
|
||||
cancel()
|
||||
callback(visibleNodes)
|
||||
this.hub.removeEventListener('emit', oneTimeSubscription)
|
||||
}
|
||||
return this.hub.addEventListener('emit', oneTimeSubscription)
|
||||
const cancel = this.hub.addEventListener('emit', oneTimeSubscription)
|
||||
return cancel
|
||||
}
|
||||
|
||||
update() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue