Closed simone-viozzi closed 3 months ago
You can already do this with https://silverbullet.md/Space%20Script#Custom%20event%20listeners
You can listen to the editor:init
event if you're interested in doing something in the client whenever it has loaded, and I think system:ready
will trigger just on the server when it has just booted. In your case you probably want to use editor:init
.
thank you i did not know that.
is there a list of all events?
Not really, that's why the linked page has an example space script to discover them.
Currently, SilverBullet lacks a direct mechanism to execute scripts or hooks purely based on the application start event.
This limitation prevents automating certain tasks that users might want to run immediately as the application loads, such as preparing the workspace for the day ahead or creating pages from templates if they don't already exist.
Proposed solution
I propose the introduction of an
onApplicationStart
hook within the Space Script API. This hook would allow users to register functions that should be executed automatically when SilverBullet starts.Here's a conceptual example of how this might look within a Space Script:
Example Use Case
As an example use case for this feature, consider the scenario where a user wants to automatically create a "Daily Agenda" page from a template each day when they first start SilverBullet.
If the page for the current day already exists, the script should do nothing.