remove Pear.preferences API (#146)

This commit is contained in:
rafapaezbas
2024-10-15 18:47:40 +02:00
committed by GitHub
parent ae3b4eeab1
commit d9b340f00e

View File

@@ -248,43 +248,6 @@ do {
} while (count++ < 1000) } while (count++ < 1000)
``` ```
## `Pear.preferences <Function|Object>`
User preferences management.
### `for await (const [operation, key, value] of Pear.preferences())`
An async iterable that yields arrays containing `operation <String>`, `key <String>` and `value <any>`.
Watch for application updates. The `operation` may be `set` or `del`. In the case of `del`, `value` is always `null`.
### `for await (const [key, value] of Pear.preferences.list())`
Iterate through all available application preferences.
### `const success = await Pear.preferences.set(key, value)`
Set a preference. The promise resolves to a boolean indicating success when the operation is complete.
### `const value = await Pear.preferences.get(key)`
Get a preference. The promise resolves with the value.
### `const success = await Pear.preferences.del(key)`
Delete a preference. The promise resolves to a boolean indicating success when the operation is complete.
```js
const { preferences } = Pear
async function logPrefUpdates () {
for await (const [ operation, key, value ] of preferences()) console.table({ update: { operation, key, value }})
}
logPrefUpdates().catch(console.error)
```
## `Pear.worker <Object>` ## `Pear.worker <Object>`
Pear Worker is used to spawn processes and facilitate communication between the parent and child processes in the Pear Runtime. Pear Worker is used to spawn processes and facilitate communication between the parent and child processes in the Pear Runtime.