Last active
March 27, 2018 03:48
-
-
Save dockimbel/aa1d5cec15f1eb4b11ece61dcebba22c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Purpose: "Implements a Pomodoro timer" | |
Note: "Original code from https://gitter.im/red/red/gui-branch?at=5ab95dae2b9dfdbc3a25636a" | |
] | |
Pomodoro: does [ | |
context [ | |
t: diff: b1: b2: end: none | |
view/no-wait [ | |
title "Pomodoro" | |
t: text "25:00" on-time [ | |
diff: difference end now | |
t/text: rejoin [diff/minute ":" pad/left/with form to-integer diff/second 2 #"0"] | |
if negative? diff/minute [print "alarm"] | |
] | |
b1: button "start" [ | |
t/rate: 10 | |
end: now + 0:25 | |
] | |
b2: button "pause" [ | |
end: either t/rate [difference end now][end + now] | |
b2/text: pick ["continue" "pause"] to-logic t/rate | |
t/rate: all [none? t/rate 10] | |
] | |
] | |
] | |
] | |
pomodoro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment