mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Refactor to use subsribers
This commit is contained in:
16 files changed
+120
-707
No files matched your search
@@ -38,9 +38,9 @@ export function useHost(id: number): [ HostState, () => void ] {
|
||||
setHost({ ...newHost, loading:false, missing:false, present:true });
|
||||
}
|
||||
|
||||
control.onHostUpdate(id, updateHandler);
|
||||
control.hostUpdate.subscribeToChannel(id, updateHandler);
|
||||
return () => {
|
||||
control.offHostUpdate(id, updateHandler);
|
||||
control.hostUpdate.unsubscribeFromChannel(id, updateHandler);
|
||||
};
|
||||
}, [id]);
|
||||
|
||||
@@ -74,9 +74,9 @@ export function useHostList() {
|
||||
});
|
||||
}
|
||||
|
||||
control.onHostUpdate(null, updateHandler);
|
||||
control.hostUpdate.subscribe(updateHandler);
|
||||
return () => {
|
||||
control.offHostUpdate(null, updateHandler);
|
||||
control.hostUpdate.unsubscribe(updateHandler);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in new issue
Block a user