Skip to content

When a scratchfile is created CAN should start to watch it

To manage this, an event handler pattern will be used. Commands will be given access to emitters for specific events, and the entry file for CAN will set up handlers for the events.

In this case, two events will be needed: SCRATCHFILE_CREATED and SCRATCHFILE_UPDATED.

The scratch command will trigger the former event, which will have a handler ready to set up a file watcher. When the file watcher detects a change, it will trigger the SCRATCHFILE_UPDATED event.

When the SCRATCHFILE_UPDATED event is detected, CAN will inform the user.