@graphql-workbench/graphql-store-core
v0.1.0
Published
Shared reactive store primitives for GraphQL web components
Readme
GraphQL Store Core
@graphql-workbench/graphql-store-core provides dependency-free runtime primitives shared by the signal
stores in the GraphQL components monorepo.
Install
npm install @graphql-workbench/graphql-store-coreTyped events
import { createStoreEventChannel } from '@graphql-workbench/graphql-store-core';
interface Events {
changed: { readonly value: number };
}
const channel = createStoreEventChannel<Events>();
const unsubscribe = channel.events.subscribe('changed', ({ value }) => {
console.log(value);
});
channel.emit('changed', { value: 1 });
unsubscribe();
channel.dispose();Delivery is synchronous and follows subscription order. Unsubscription and disposal are idempotent. Disposed channels ignore emissions and reject new subscriptions.
Development
Run commands from the monorepo root:
npm ci
npm run check --workspace=@graphql-workbench/graphql-store-core