mobx-keystone-yjs
Version:
Yjs bindings for mobx-keystone
36 lines (35 loc) • 971 B
TypeScript
import { AnyType } from "mobx-keystone";
import * as Y from "yjs";
/**
* Context with info on how a mobx-keystone model is bound to a Y.js data structure.
*/
export interface YjsBindingContext {
/**
* The Y.js document.
*/
yjsDoc: Y.Doc;
/**
* The bound Y.js data structure.
*/
yjsObject: Y.Map<unknown> | Y.Array<unknown> | Y.Text;
/**
* The mobx-keystone model type.
*/
mobxKeystoneType: AnyType;
/**
* The origin symbol used for transactions.
*/
yjsOrigin: symbol;
/**
* The bound mobx-keystone instance.
*/
boundObject: unknown;
/**
* Whether we are currently applying Y.js changes to the mobx-keystone model.
*/
isApplyingYjsChangesToMobxKeystone: boolean;
}
/**
* Context with info on how a mobx-keystone model is bound to a Y.js data structure.
*/
export declare const yjsBindingContext: import("mobx-keystone").Context<YjsBindingContext | undefined>;