UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

36 lines (35 loc) 1.09 kB
import { Patch } from '../../../json-crdt-patch'; import type { JsonNode } from '../../nodes'; import type { ModelApi } from './nodes'; export declare const enum ChangeEventOrigin { Local = 0, Remote = 1, Reset = 2 } export type RawEventData = /** Emitted by RESET event, set of nodes directly affected by the reset. */ Set<JsonNode> /** Emitted by LOCAL event, the starting index in the un-flushed patch. */ | number /** Emitted by `.applyPatch(patch: Patch)`. */ | Patch; export declare class ChangeEvent { readonly raw: RawEventData; readonly api: ModelApi<any>; constructor(raw: RawEventData, api: ModelApi<any>); origin(): ChangeEventOrigin; isLocal(): boolean; isReset(): boolean; private _direct; /** * JSON CRDT nodes directly affected by this change event, i.e. nodes * which are direct targets of operations in the change. */ direct(): Set<JsonNode>; private _parents; /** * JSON CRDT nodes which are parents of directly affected nodes in this * change event. */ parents(): Set<JsonNode>; }