mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +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) {
|
||||
if (!this.refCount) {
|
||||
if (this.refCount === 0) {
|
||||
const update = () => { this.fetchDefaultModPack(control); };
|
||||
update();
|
||||
this.interval = setInterval(update, 60e3);
|
||||
@@ -37,7 +37,7 @@ class DefaultModPackStore {
|
||||
return () => {
|
||||
this.callbacks.splice(this.callbacks.indexOf(callback), 1);
|
||||
this.refCount -= 1;
|
||||
if (!this.refCount) {
|
||||
if (this.refCount === 0) {
|
||||
clearInterval(this.interval);
|
||||
this.interval = undefined;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user