LedgerUI.Timer (LedgerUI v0.2.0)

Copy Markdown View Source

Commands for a <.timer> (see LedgerUI.Components.Timer).

In the browser, with no round trip (phx-click):

phx-click={LedgerUI.Timer.pause("shift")}
phx-click={LedgerUI.Timer.resume("shift")}
phx-click={LedgerUI.Timer.toggle("shift")}
phx-click={LedgerUI.Timer.add("shift", 900)}

From the server: LedgerUI.Timer.add(socket, "shift", 900), pause/2, resume/2, toggle/2. add takes time away with a negative number.

Summary

Functions

Browser command: adds seconds to the elapsed time of the timer id.

Server command: adds seconds to the elapsed time of the timer id.

Browser command: pause the timer id.

Server command: pause the timer id.

Browser command: resume the timer id.

Server command: resume the timer id.

Browser command: toggle the timer id.

Server command: toggle the timer id.

Functions

add(id, seconds)

Browser command: adds seconds to the elapsed time of the timer id.

add(socket, id, seconds)

Server command: adds seconds to the elapsed time of the timer id.

pause(id)

Browser command: pause the timer id.

pause(socket, id)

Server command: pause the timer id.

resume(id)

Browser command: resume the timer id.

resume(socket, id)

Server command: resume the timer id.

toggle(id)

Browser command: toggle the timer id.

toggle(socket, id)

Server command: toggle the timer id.