Fixing MemoryLeak
This commit is contained in:
parent
858a508190
commit
35323a095a
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hibas123/utils",
|
"name": "@hibas123/utils",
|
||||||
"version": "2.2.4",
|
"version": "2.2.5",
|
||||||
"description": "Different Utilities, that are not worth own packages",
|
"description": "Different Utilities, that are not worth own packages",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
@ -96,15 +96,17 @@ export default class Observable<T = any> {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.events.push(data);
|
if (this.subscribeCollect.length > 0) {
|
||||||
if (!this.timeout && this.subscriberCollect.length > 0) {
|
this.events.push(data);
|
||||||
this.timeout = setTimeout(() => {
|
if (!this.timeout) {
|
||||||
this.subscriberCollect.forEach((cb) => {
|
this.timeout = setTimeout(() => {
|
||||||
cb(this.events);
|
this.subscriberCollect.forEach((cb) => {
|
||||||
});
|
cb(this.events);
|
||||||
this.events = [];
|
});
|
||||||
this.timeout = undefined;
|
this.events = [];
|
||||||
}, this.collect_intervall);
|
this.timeout = undefined;
|
||||||
|
}, this.collect_intervall);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user