@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

ParameterType
_handler{ getUniverSheet: (id) => | null | FWorkbook; }
_handler.getUniverSheet(id) => | null | FWorkbook
_injectorInjector
_univerInstanceServiceIUniverInstanceService
_snapshotServiceSnapshotService
_collaborationControllerCollaborationController

Returns

FCollaboration

Overrides

FBase.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_collaborationControllerreadonlyCollaborationControllerundefined-packages/collaboration-client/src/facade/f-collaboration.ts:15
_disposedprotectedbooleanfalseFBase._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:96
_injectorreadonlyInjectorundefined-packages/collaboration-client/src/facade/f-collaboration.ts:12
_snapshotServicereadonlySnapshotServiceundefined-packages/collaboration-client/src/facade/f-collaboration.ts:14
_univerInstanceServicereadonlyIUniverInstanceServiceundefined-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

FBase.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FBase.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FBase.ensureNotDisposed


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

ParameterType
unitIdstring

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

ParameterTypeDescription
unitIdstringID 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

ParameterTypeDescription
unitIdstringID of the Univer file.
callback(members) => voidA callback function that will be called when the collaborators change.

Returns

IDisposable

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

ParameterType
sourceany

Returns

void

Inherited from

FBase.extend