| Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
| Version 1.9 Build 1556 |
|
| Package | utility | |
| Module | misc |
include "timer.g"
| execute | execute a function periodically |
| remove | remove a callback function from the timer |
| wait | wait a specified amount of time |
timer is a single tool, only one will be created in a given glish session. The timer is created the first time timer.g is included in a glish session.
- reminder := function(interval, name) { print 'Do not forget your meeting!'; }
- # Run reminder every 5 minutes
- id := timer.execute(reminder, interval=300, oneshot=F)
- ... time passes ... the following message comes up every 5 minutes
Do not forget your meeting!
- ...
- timer.remove(id); # Turn off reminder