Event pages are plugins that run themselves. Name a page Event: Name and its script fires when that thing happens — the page is the handler.
| Page name | Fires | mojo.event contains |
|---|---|---|
Event: Open | when the document opens | type |
Event: Page View | after navigating to any page | type, page |
Event: Export | before any document export | type, destination |
Event: Publish | before Static Publishing writes the site | type, destination (the folder) |
Event: Daily Note | when a daily note is created | type, page, date |
Inside, the full mojo API is available, plus mojo.event
with the details above. A tiny example — keep a visit log. Create
Event: Page View containing:
if (!mojo.exists('Log')) await mojo.create('Log')
mojo.append('Log', mojo.today() + ' — ' + mojo.event.page)
Event scripts won't trigger themselves recursively, and errors flash in the status bar instead of interrupting you.