@@ -23,10 +23,10 @@ let getFeedData = (): option<cameraFeedData> => {
2323// Motion detection callbacks - keyed by camera IP address
2424// WorldScreen registers callbacks to update camera sprite indicators
2525// Callback receives: None = disabled/grey, Some(false) = no motion/blue, Some(true) = motion/orange
26- let motionCallbacks : Js . Dict . t <option <bool > => unit > = Js . Dict .empty ()
26+ let motionCallbacks : dict <option <bool > => unit > = Dict .make ()
2727
2828let registerMotionCallback = (cameraIp : string , callback : option <bool > => unit ): unit => {
29- Js . Dict .set (motionCallbacks , cameraIp , callback )
29+ Dict .set (motionCallbacks , cameraIp , callback )
3030}
3131
3232let unregisterMotionCallback = (cameraIp : string ): unit => {
@@ -35,15 +35,15 @@ let unregisterMotionCallback = (cameraIp: string): unit => {
3535
3636// Motion status: None = disabled/grey, Some(false) = no motion/blue, Some(true) = motion/orange
3737let notifyMotionStatus = (cameraIp : string , motionDetected : bool ): unit => {
38- switch Js . Dict .get (motionCallbacks , cameraIp ) {
38+ switch Dict .get (motionCallbacks , cameraIp ) {
3939 | Some (callback ) => callback (Some (motionDetected ))
4040 | None => ()
4141 }
4242}
4343
4444// Notify camera is disabled (grey indicator)
4545let notifyCameraDisabled = (cameraIp : string ): unit => {
46- switch Js . Dict .get (motionCallbacks , cameraIp ) {
46+ switch Dict .get (motionCallbacks , cameraIp ) {
4747 | Some (callback ) => callback (None )
4848 | None => ()
4949 }
@@ -81,17 +81,17 @@ let getHackerRelativePosition = (cameraX: float, viewWidth: float): option<float
8181
8282// Camera positions in world - used for background motion checking
8383// Maps IP address to (worldX, viewWidth)
84- let cameraPositions : Js . Dict . t <(float , float )> = Js . Dict .empty ()
84+ let cameraPositions : dict <(float , float )> = Dict .make ()
8585
8686// Track which cameras are disabled (to skip in background motion check)
8787let disabledCameras : Set .t <string > = Set .make ()
8888
8989// Track which cameras are looping and their frozen motion state
9090// Maps IP to frozen motion state (true = motion detected, false = no motion)
91- let loopingCameras : Js . Dict . t <bool > = Js . Dict .empty ()
91+ let loopingCameras : dict <bool > = Dict .make ()
9292
9393let registerCameraPosition = (cameraIp : string , worldX : float , viewWidth : float ): unit => {
94- Js . Dict .set (cameraPositions , cameraIp , (worldX , viewWidth ))
94+ Dict .set (cameraPositions , cameraIp , (worldX , viewWidth ))
9595}
9696
9797let setCameraEnabled = (cameraIp : string , enabled : bool ): unit => {
@@ -104,7 +104,7 @@ let setCameraEnabled = (cameraIp: string, enabled: bool): unit => {
104104
105105let setCameraLooping = (cameraIp : string , looping : bool , frozenMotionState : bool ): unit => {
106106 if looping {
107- Js . Dict .set (loopingCameras , cameraIp , frozenMotionState )
107+ Dict .set (loopingCameras , cameraIp , frozenMotionState )
108108 } else {
109109 Dict .delete (loopingCameras , cameraIp )
110110 }
@@ -113,7 +113,7 @@ let setCameraLooping = (cameraIp: string, looping: bool, frozenMotionState: bool
113113// Update all camera motion statuses based on hacker position
114114// Called from WorldScreen update loop
115115let updateAllCameraMotion = (): unit => {
116- Js . Dict .entries (cameraPositions )-> Belt .Array .forEach (((ip , position )) => {
116+ Dict .toArray (cameraPositions )-> Belt .Array .forEach (((ip , position )) => {
117117 let (worldX , viewWidth ) = position
118118
119119 // Skip disabled cameras
@@ -124,16 +124,16 @@ let updateAllCameraMotion = (): unit => {
124124 let hasPower = PowerManager .isDeviceOperational (ip )
125125 if ! hasPower {
126126 // No power - show grey indicator
127- switch Js . Dict .get (motionCallbacks , ip ) {
127+ switch Dict .get (motionCallbacks , ip ) {
128128 | Some (callback ) => callback (None )
129129 | None => ()
130130 }
131131 } else {
132132 // Check if this camera has a motion callback registered
133- switch Js . Dict .get (motionCallbacks , ip ) {
133+ switch Dict .get (motionCallbacks , ip ) {
134134 | Some (callback ) =>
135135 // Check if camera is looping - use frozen state instead of live detection
136- switch Js . Dict .get (loopingCameras , ip ) {
136+ switch Dict .get (loopingCameras , ip ) {
137137 | Some (frozenMotion ) =>
138138 // Camera is looping - show the frozen motion state
139139 callback (Some (frozenMotion ))
0 commit comments