mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 16:23:12 +09:00
Explicitly compare refCount with 0
This commit is contained in:
1 parent
0d28a3ac3c
commit
781b98b1c1
1 file changed
+2
-2
@@ -27,7 +27,7 @@ class DefaultModPackStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subscribe(control: Control, callback: () => void) {
|
subscribe(control: Control, callback: () => void) {
|
||||||
if (!this.refCount) {
|
if (this.refCount === 0) {
|
||||||
const update = () => { this.fetchDefaultModPack(control); };
|
const update = () => { this.fetchDefaultModPack(control); };
|
||||||
update();
|
update();
|
||||||
this.interval = setInterval(update, 60e3);
|
this.interval = setInterval(update, 60e3);
|
||||||
@@ -37,7 +37,7 @@ class DefaultModPackStore {
|
|||||||
return () => {
|
return () => {
|
||||||
this.callbacks.splice(this.callbacks.indexOf(callback), 1);
|
this.callbacks.splice(this.callbacks.indexOf(callback), 1);
|
||||||
this.refCount -= 1;
|
this.refCount -= 1;
|
||||||
if (!this.refCount) {
|
if (this.refCount === 0) {
|
||||||
clearInterval(this.interval);
|
clearInterval(this.interval);
|
||||||
this.interval = undefined;
|
this.interval = undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user