* Removed code complete from mini editor (didn't really work anyway, and only use case was emoji) * Changed meta picker to be more consistent with page picker * Alt-space completion in page picker (completes "folder" to the top match)
2.0 KiB
2.0 KiB
SilverBullet has its own event bus.
Events can be subscribed to and dispatched via the API/event API. Other features, such as Service are built on top of Events.
Built-in events
Here is a list of built-in events (triggered by SilverBullet’s core).
To use them, simply subscribe to them via API/event#event.listen(listenerDef), and do a print to see what data you receive. Alternatively, grep the code base to see exactly where they are triggered.
page:click: user clicks a location on the pagepage:index: page has changed and requested to be indexed (used by Object indexing)editor:complete: editor completion triggered, returns completion resultsslash:complete: slash completion triggered, returns completion resultseditor:lint: request to lint, returns errorseditor:init: editor initializededitor:pageLoaded: page has loaded in the editoreditor:pageReloaded: page reloaded in the editor (e.g. when it was changed on disk)editor:pageSaving: page is about to saveeditor:pageSaved: page has savededitor:pageCreating: page is creating (can return a page content object)editor:pageModified: a change was made to the document (real-time)editor:documentSaving: a document is about to be savededitor:documentSaved: a document was savededitor:modeswitch: triggered between vim mode and non-vim modeeditor:fold: code was folded in the editoreditor:unfold: code was unfolded in the editorplugs:loaded: plugs were loadedcron:secondPassed: a second has passed (useful to implement cron-like features)hooks:renderTopWidgets: top widgets have requested to render (return widgets)hooks:renderBottomWidgets: bottom widgets have requested to render (return widgets)
All subscribed events
Here’s a dynamically generated list of events that this SilverBullet instance has subscribed to, to give a sense of what’s there: ${query[[ from event.listEvents() where not _:startsWith("service:") order by _ ]]}