-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add ot typing Signed-off-by: Raccoon <[email protected]>
- Loading branch information
1 parent
847acda
commit f35d684
Showing
3 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import SocketIO from "socket.io"; | ||
import EventEmitter from "events"; | ||
|
||
declare module 'ot' { | ||
|
||
export const version: number | ||
|
||
export type Operation = number | string | ||
|
||
export class TextOperation { | ||
static isRetain(op: Operation): boolean | ||
|
||
static isInsert(op: Operation): boolean | ||
|
||
static isDelete(op: Operation): boolean | ||
} | ||
|
||
export class EditorSocketIOServer extends EventEmitter { | ||
|
||
public isDirty: boolean | ||
public document: string | ||
public debug: boolean | ||
public operations: Operation[] | ||
|
||
constructor( | ||
document: string, | ||
operations: Operation[], | ||
docId: string, | ||
mayWrite: ( | ||
socket: SocketIO.Socket, | ||
callback: (canEdit: boolean) => void) => void, | ||
operationCallback: ( | ||
socket: SocketIO.Socket, | ||
operation: Operation[]) => void, | ||
operationEventCallback?: any) | ||
|
||
setLogger(logger): void | ||
|
||
debugLog(mes: string): void | ||
|
||
setDocumentMaxLength(number): void | ||
|
||
addClient(socket: SocketIO.Socket): void | ||
|
||
onOperation(socket: SocketIO.Server, revision, operation, selection) | ||
|
||
onGetOperations(socket, base, head) | ||
|
||
updateSelection(socket, selection) | ||
|
||
setName(socket, name) | ||
|
||
setColor(socket, color) | ||
|
||
getClient(clientId) | ||
|
||
onDisconnect(socket) | ||
} | ||
|
||
} | ||
|
||
|