Skip to content

Instantly share code, notes, and snippets.

@phedkvist
Created February 27, 2021 13:09
Show Gist options
  • Save phedkvist/2ac29ac5cee8e20d95c022f87f74e4a0 to your computer and use it in GitHub Desktop.
Save phedkvist/2ac29ac5cee8e20d95c022f87f74e4a0 to your computer and use it in GitHub Desktop.
crdt-woot
export interface Site {
siteId: string; // unique id for each site
clock: number;
sequence: Char[];
operationPool: Char[];
}
export interface Char {
id: string;
charId: CharId;
value: string;
visible: boolean;
prevId: string;
nextId: string;
}
export interface CharId {
siteId: string;
clock: number;
}
export enum Operation {
Insert = 'insert',
Delete = 'delete',
}
export interface Payload {
char: Char;
operation: Operation;
id: string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment