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