-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.d.ts
87 lines (74 loc) · 2.17 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { EventEmitter } from 'eventemitter3'
import SheetEditor from '../../sheet/editor/editor'
import * as SheetCollaborators from '../../sheet/plugins/collaborators'
import * as DocumentCollaborator from '../../document/plugins/collaborator'
import DocumentEditor from '../../document/editor'
import { IUser } from '../../global'
export enum Status {
OFFLINE = 'offline',
OFFLINE_SAVING = 'offlineSaving',
OFFLINE_SAVED = 'offlineSaved',
OFFLINE_SAVE_FAILED = 'offlineSaveFailed',
ONLINE = 'online',
ONLINE_SAVING = 'onlineSaving',
ONLINE_SAVED = 'onlineSaved',
ONLINE_SAVE_FAILED = 'onlineSaveFailed',
SERVER_CHANGE_APPLIED = 'serverChangeApplied'
}
export enum Events {
error = 'error',
saveStatusChange = 'saveStatusChange',
broadcast = 'broadcast',
enter = 'enter',
leave = 'leave'
}
export interface CollaborationOptions {
/**
* 内容类型,由内部模块处理,外部不需要配置
*/
type?: string
/**
* 版本号,由内部模块处理,外部不需要配置
*/
rev: number
/**
* 文件 GUID,由内部模块处理,外部不需要配置
*/
guid: string
/**
* Pull API,由内部模块处理,外部不需要配置
*/
pullUrl: string
/**
* Compose API,由内部模块处理,外部不需要配置
*/
composeUrl: string
/**
* Select API,由内部模块处理,外部不需要配置
*/
selectUrl: string
/**
* Editor 实例,由内部模块处理,外部不需要配置
*/
editor: SheetEditor | DocumentEditor
/**
* 协作者实例,一般由内部模块处理,外部不需要配置
*/
collaborators?: SheetCollaborators.default | DocumentCollaborator.default
/**
* 离线编辑开关,目前无任何效果
*/
offlineEditable?: boolean
/**
* 用于自定义保存状态的显示,如「正在保存」、「保存成功」的切换
*/
onSaveStatusChange?: (status: ShimoSDK.Common.CollaborationStatus) => void
}
export default class Collaboration extends EventEmitter<Events> {
public guid: string
constructor (options: CollaborationOptions);
start (): void
destroy (): void
getCollaborators (): IUser[]
haveUnsavedChange (): boolean
}