From 86f63cc80ee1bf962edc254f42a94f0fa375acd7 Mon Sep 17 00:00:00 2001 From: Bryan Lundberg Date: Mon, 9 Dec 2024 07:06:19 -0600 Subject: [PATCH] fix: add stop event to stackmat controller --- src/components/stackmat.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/components/stackmat.tsx b/src/components/stackmat.tsx index 09e51233..6bf6c26f 100644 --- a/src/components/stackmat.tsx +++ b/src/components/stackmat.tsx @@ -111,16 +111,39 @@ export default function Stackmat() { toast("Device disconnected"); }; + /* + TESTED SECTION + ---------------- + The following events have been thoroughly tested using the QIYI Timer V2. + They ensure controlled behavior for handling timer events: + + - Issue reported: Some users are unable to stop the timer. + */ + stackmat.on("started", onStarted); stackmat.on("reset", onReset); stackmat.on("timerConnected", onConnected); stackmat.on("timerDisconnected", onDisconnected); + /* + EXPERIMENTAL SECTION + --------------------- + The following event is experimental and has not been tested. + It was implemented based on the standard controller library's documentation + to handle potential edge cases where events might be missing for certain users. + + Event: + - "stopped": This event is expected to trigger when the timer stops. + */ + + stackmat.on("stopped", onReset); + return () => { stackmat.off("started", onStarted); stackmat.off("reset", onReset); stackmat.off("timerConnected", onConnected); stackmat.off("timerDisconnected", onDisconnected); + stackmat.off("stopped", onReset); }; } }, [