@univerjscoreinterfacesIuniverinstanceservice

@univerjs/core v0.5.4


Interface: IUniverInstanceService

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:49

IUniverInstanceService holds all the current univer instances and provides a set of methods to add and remove univer instances.

It also manages the focused univer instance.

Properties

PropertyTypeDescriptionDefined in
focused$Observable<Nullable<string>>An observable value that emits the id of the focused unit.packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:64
unitAdded$Observable<UnitModel>Omits value when a new UnitModel is created.packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:51
unitDisposed$Observable<UnitModel>Omits value when a UnitModel is disposed.packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:59

Methods

changeDoc()

changeDoc(unitId, doc): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:82

Parameters

ParameterType
unitIdstring
docDocumentDataModel

Returns

void

Deprecated


createUnit()

createUnit<T, U>(
   type, 
   data, 
   options?): U

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:75

Create a unit with snapshot info.

Type Parameters

Type Parameter
T
U extends UnitModel

Parameters

ParameterType
typenumber
dataPartial<T>
options?ICreateUnitOptions

Returns

U


disposeUnit()

disposeUnit(unitId): boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:77

Dispose a unit

Parameters

ParameterType
unitIdstring

Returns

boolean


focusUnit()

focusUnit(unitId): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:66

Focus a unit.

Parameters

ParameterType
unitIdnull | string

Returns

void


getAllUnitsForType()

getAllUnitsForType<T>(type): T[]

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:85

Type Parameters

Type Parameter
T

Parameters

ParameterType
typenumber

Returns

T[]


getCurrentTypeOfUnit$()

getCurrentTypeOfUnit$<T>(type): Observable<Nullable<T>>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:72

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typenumber

Returns

Observable<Nullable<T>>


getCurrentUnitForType()

getCurrentUnitForType<T>(type): Nullable<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:69

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typenumber

Returns

Nullable<T>


getCurrentUniverDocInstance()

getCurrentUniverDocInstance(): Nullable<DocumentDataModel>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:93

Returns

Nullable<DocumentDataModel>

Deprecated


getFocusedUnit()

getFocusedUnit(): Nullable<UnitModel>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:67

Returns

Nullable<UnitModel>


getTypeOfUnitAdded$()

getTypeOfUnitAdded$<T>(type): Observable<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:53

Subscribe to curtain type of units’ creation.

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typenumber

Returns

Observable<T>


getTypeOfUnitDisposed$()

getTypeOfUnitDisposed$<T>(type): Observable<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:61

Subscribe to curtain type of units’ disposing.

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typenumber

Returns

Observable<T>


getUnit()

getUnit<T>(id, type?): Nullable<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:84

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
idstring
type?number

Returns

Nullable<T>


getUnitType()

getUnitType(unitId): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:86

Parameters

ParameterType
unitIdstring

Returns

number


getUniverDocInstance()

getUniverDocInstance(unitId): Nullable<DocumentDataModel>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:91

Parameters

ParameterType
unitIdstring

Returns

Nullable<DocumentDataModel>

Deprecated


getUniverSheetInstance()

getUniverSheetInstance(unitId): Nullable<Workbook>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:89

Parameters

ParameterType
unitIdstring

Returns

Nullable<Workbook>

Deprecated


registerCtorForType()

registerCtorForType<T>(type, ctor): IDisposable

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:79

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typenumber
ctor(…args) => T

Returns

IDisposable


setCurrentUnitForType()

setCurrentUnitForType(unitId): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:70

Parameters

ParameterType
unitIdstring

Returns

void