Fixing MemoryLeak
This commit is contained in:
@ -96,15 +96,17 @@ export default class Observable<T = any> {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
this.events.push(data);
|
||||
if (!this.timeout && this.subscriberCollect.length > 0) {
|
||||
this.timeout = setTimeout(() => {
|
||||
this.subscriberCollect.forEach((cb) => {
|
||||
cb(this.events);
|
||||
});
|
||||
this.events = [];
|
||||
this.timeout = undefined;
|
||||
}, this.collect_intervall);
|
||||
if (this.subscribeCollect.length > 0) {
|
||||
this.events.push(data);
|
||||
if (!this.timeout) {
|
||||
this.timeout = setTimeout(() => {
|
||||
this.subscriberCollect.forEach((cb) => {
|
||||
cb(this.events);
|
||||
});
|
||||
this.events = [];
|
||||
this.timeout = undefined;
|
||||
}, this.collect_intervall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user