mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-08-05 20:23:46 +02:00
Format all files with Prettier
This commit is contained in:
@@ -7,7 +7,12 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export function useWSForisModule(ws, module, action = "update_settings", controllerID) {
|
||||
export function useWSForisModule(
|
||||
ws,
|
||||
module,
|
||||
action = "update_settings",
|
||||
controllerID
|
||||
) {
|
||||
const [data, setData] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -18,14 +23,16 @@ export function useWSForisModule(ws, module, action = "update_settings", control
|
||||
|
||||
function callback(message) {
|
||||
// Accept only messages addressed to device with passed controller ID.
|
||||
if (controllerID !== undefined && controllerID !== message.controller_id) {
|
||||
if (
|
||||
controllerID !== undefined &&
|
||||
controllerID !== message.controller_id
|
||||
) {
|
||||
return;
|
||||
}
|
||||
setData(message.data);
|
||||
}
|
||||
|
||||
ws.subscribe(module)
|
||||
.bind(module, action, callback);
|
||||
ws.subscribe(module).bind(module, action, callback);
|
||||
|
||||
return () => {
|
||||
ws.unbind(module, action, callback);
|
||||
|
Reference in New Issue
Block a user