@atolljs/solidjs
v0.1.14
Published
SolidJS bindings — createObservable, createSharedValue, createTask
Readme
@atolljs/solidjs
SolidJS bindings for @atolljs/core — shared-memory fields and worker tasks as
natively tracked Accessors (the SDK uses solid-js internally for its
reactive core). Subscriptions auto-dispose via onCleanup when the owner is
destroyed.
Install
npm install @atolljs/core @atolljs/solidjsUsage
import { createSharedValue, createTask } from '@atolljs/solidjs';
import { counterMemory } from './counter.memory';
import { counter } from './counter';
export function App() {
const count = createSharedValue(counterMemory, 'count');
const increment = createTask(counter.increment);
return (
<button onClick={() => increment.run(1)}>
count: {count() ?? '…'}
</button>
);
}API
createObservable(source)— subscribe to anyObservableValuesnapshot as anAccessor.createSharedValue(memory, key, select?, options?)— bind one shared-memory field to anAccessor; optional selector +equals.createTask(task | asyncFn)— bind anAsyncTask(or any async fn) to{ state: Accessor<TaskSnapshot> }plusrun/runOncetriggers.
Notes
- Worker-hosted Solid trees (islands) live in the companion package
@atolljs/solid-island.
