pull/1036/head
Zef Hemel 2024-08-08 20:49:55 +02:00
parent 0f5a54e91d
commit 183afb4834
1 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ The `silverbullet.registerFunction` API takes two arguments:
* `callback`: the callback function to invoke (can be `async` or not)
## Example
Even though a [[Functions#readPage(name)]] function already exist, you could implement it in space script as follows (lets name it `myReadPage`) using the `syscall` API (detailed further in [[#Syscalls]]):
Even though a [[Functions#readPage(name)]] function already exist, you could implement it in space script as follows (lets name it `myReadPage`) using the [space.readPage](https://jsr.io/@silverbulletmd/silverbullet/doc/syscalls/~/space.readPage) syscall:
```space-script
silverbullet.registerFunction({name: "myReadPage"}, async (name) => {
@ -64,7 +64,7 @@ silverbullet.registerFunction({name: "myReadPage"}, async (name) => {
})
```
Note: this could be written more succinctly, but this demonstrates how to use `async` and `await` in space script as well.
**Note:** this could be written more succinctly, but this demonstrates how to use `async` and `await` in space script as well.
This function can be invoked as follows: