@univerjs-pro/collaboration-client v0.5.4
Class: FCollaboration
Defined in: packages/collaboration-client/src/facade/f-collaboration.ts:9
FBase
is a base class for all facade classes.
It provides a way to extend classes with static and instance methods.
The _initialize
as a special method that will be called after the constructor. You should never call it directly.
Extends
Constructors
new FCollaboration()
new FCollaboration(
_handler,
_injector,
_univerInstanceService,
_snapshotService,
_collaborationController): FCollaboration
Defined in: packages/collaboration-client/src/facade/f-collaboration.ts:10
Parameters
Parameter | Type |
---|---|
_handler | { getUniverSheet : (id ) => | null | FWorkbook ; } |
_handler.getUniverSheet | (id ) => | null | FWorkbook |
_injector | Injector |
_univerInstanceService | IUniverInstanceService |
_snapshotService | SnapshotService |
_collaborationController | CollaborationController |
Returns
Overrides
Properties
Property | Modifier | Type | Default value | Inherited from | Defined in |
---|---|---|---|---|---|
_collaborationController | readonly | CollaborationController | undefined | - | packages/collaboration-client/src/facade/f-collaboration.ts:15 |
_disposed | protected | boolean | false | FBase ._disposed | submodules/univer/packages/core/src/shared/lifecycle.ts:96 |
_injector | readonly | Injector | undefined | - | packages/collaboration-client/src/facade/f-collaboration.ts:12 |
_snapshotService | readonly | SnapshotService | undefined | - | packages/collaboration-client/src/facade/f-collaboration.ts:14 |
_univerInstanceService | readonly | IUniverInstanceService | undefined | - | packages/collaboration-client/src/facade/f-collaboration.ts:13 |
Methods
dispose()
dispose(): void
Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:109
Returns
void
Inherited from
disposeWithMe()
disposeWithMe(disposable): IDisposable
Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
ensureNotDisposed()
protected ensureNotDisposed(): void
Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103
Returns
void
Inherited from
loadActiveSheet()
loadActiveSheet(): Promise<
| null
| FWorkbook>
Defined in: packages/collaboration-client/src/facade/f-collaboration.ts:23
Returns
Promise
<
| null
| FWorkbook
>
Deprecated
Use loadActiveSheetAsync
instead.
loadActiveSheetAsync()
loadActiveSheetAsync(): Promise<
| null
| FWorkbook>
Defined in: packages/collaboration-client/src/facade/f-collaboration.ts:39
Load the active Univer Sheet. It should be associated with the Uniscript Node.js Runtime.
Returns
Promise
<
| null
| FWorkbook
>
The FWorkbook or null if the active Univer Sheet cannot be loaded.
Throws
If the method is not overridden.
Example
const collaboration = univerAPI.getCollaboration();
const workbook = await collaboration.loadActiveSheetAsync();
***
### ~~loadSheet()~~
```ts
loadSheet(unitId): Promise<
| null
| FWorkbook>
Defined in: packages/collaboration-client/src/facade/f-collaboration.ts:46
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Promise
<
| null
| FWorkbook
>
Deprecated
Use loadSheetAsync
instead.
loadSheetAsync()
loadSheetAsync(unitId): Promise<
| null
| FWorkbook>
Defined in: packages/collaboration-client/src/facade/f-collaboration.ts:61
Load a Univer Sheet from the server with a unit ID.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | ID of the Univer Sheet that you would like to load. |
Returns
Promise
<
| null
| FWorkbook
>
The FWorkbook or null if ID cannot be associated with a Univer Sheet.
Example
const collaboration = univerAPI.getCollaboration();
const workbook = await collaboration.loadSheetAsync('your-unit-id');
subscribeCollaborators()
subscribeCollaborators(unitId, callback): IDisposable
Defined in: packages/collaboration-client/src/facade/f-collaboration.ts:86
Subscribe collaborators of a Univer file.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | ID of the Univer file. |
callback | (members ) => void | A callback function that will be called when the collaborators change. |
Returns
A handler to dispose the subscription.
Example
const collaboration = univerAPI.getCollaboration();
collaboration.subscribeCollaborators('your-unit-id', (members) => {
console.log(members);
});
extend()
static extend(source): void
Defined in: submodules/univer/packages/core/src/facade/f-base.ts:26
Parameters
Parameter | Type |
---|---|
source | any |
Returns
void