diff --git a/reference/pear/api.md b/reference/pear/api.md index 35e0ad5..a93664e 100644 --- a/reference/pear/api.md +++ b/reference/pear/api.md @@ -261,6 +261,24 @@ async function logPrefUpdates () { logPrefUpdates().catch(console.error) ``` +## `Pear.worker ` + +Pear Worker is used to spawn processes and facilitate communication between the parent and child processes in the Pear Runtime. + +The spawned worker process inherits standard input, output, and error from the parent process. + +A bidirectional pipe is also created which enables communication between the parent and worker process. + +Reference counting is handled automatically to manage the sidecar lifecycle. + +### `const pipe = Pear.worker.run(key )` + +Spawns a new process with the specified key as the entry point. Resolves to a `Duplex` stream object representing a pipe. + +### `const pipe = Pear.worker.pipe()` + +Returns the communication pipe created to the worker process. Resolves to a `Duplex` stream object representing a pipe. + ## `Pear.media ` Media interface diff --git a/reference/pear/configuration.md b/reference/pear/configuration.md index 400dd36..56a2735 100644 --- a/reference/pear/configuration.md +++ b/reference/pear/configuration.md @@ -120,6 +120,14 @@ Enable transparency. Must be set for opacity to work. Background color (Hex, RGB, RGBA, HSL, HSLA, CSS color). +### `pear.links ` + +An array or object containing trusted Pear application keys. + +#### `pear.links.worker ` + +The key of the Pear application that contains the worker script. For more info, please check the [terminal](https://github.com/holepunchto/pear/blob/main/examples/terminal/index.js#L21) and [desktop](https://github.com/holepunchto/pear/blob/main/examples/desktop/app.js#L27) examples. + ### `pear.stage ` Staging configuration options.