Source code for this sample can be found on GitHub.

Scratch-event-timer

Example on how to use an event function with an Timer trigger.