Reference
Arcane.preferences.set()
Atomically writes one preference under the 1 MiB total quota. Requires preferences.write.
This focused page is derived from the mechanically checked full member inventory.
Syntax
Arcane.preferences.set(key, value)
Parameters
key; JSON-compatible value up to 131,072 encoded bytes
Return value
Promise<{key, value, bytes, totalBytes, maximumBytes}>
Description
Atomically writes one preference under the 1 MiB total quota. Requires preferences.write.
Overview
Atomically creates or replaces one app-scoped preference. The complete value is validated before mutation, and the resolved receipt returns the JSON-normalized value that was actually persisted.
Input, result, and errors
Requires preferences.write. Keys and values use the storage key, JSON, 128 KiB
per-value, and 1 MiB total-envelope limits. The promise resolves to
{key,value,bytes,totalBytes,maximumBytes}. Invalid JSON-compatible data or a
quota overflow rejects without replacing the prior preference document.
Example
async function saveDensity(density) {
if (!['compact', 'comfortable'].includes(density)) {
throw new TypeError('Unsupported density');
}
return Arcane.preferences.set('layout.density', density);
}
await saveDensity('compact');