Skip to content

Vizel API / core/src / createVizelEditorTransactionStore

Function: createVizelEditorTransactionStore()

ts
function createVizelEditorTransactionStore(getEditor): VizelEditorTransactionStore;

Defined in: packages/core/src/controllers/transactionStore.ts:43

Create a VizelEditorTransactionStore that observes whichever editor getEditor currently returns. The factory is framework-agnostic; each framework wraps the store in its native reactivity primitive.

Parameters

ParameterType
getEditor() => Editor | null | undefined

Returns

VizelEditorTransactionStore

Example

tsx
// React adapter via useSyncExternalStore:
const store = createVizelEditorTransactionStore(() => editor);
useSyncExternalStore(store.subscribe, store.getVersion, store.getVersion);

Released under the MIT License.