How to use the sharedb/lib/client.types.register function in sharedb

To help you get started, we’ve selected a few sharedb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / xforge-common / realtime-doc.ts View on Github external
import * as RichText from 'rich-text';
import { fromEvent, Observable, of, Subject, merge } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { Doc, OTType, Snapshot, types } from 'sharedb/lib/client';

types.register(RichText.type);

/**
 * This interface represents a realtime document. Realtime documents can be concurrently updated by multiple users. The
 * realtime document is synchronized in realtime for all users.
 */
export interface RealtimeDoc {
  readonly id: string;
  readonly data: any;
  readonly version: number;
  readonly type: OTType;
  readonly pendingOps: any[];

  idle(): Observable;
  fetch(): Promise;
  ingestSnapshot(snapshot: Snapshot): Promise;
  subscribe(): Promise;