@univerjscoreclassesUniverinstanceservice

@univerjs/core v0.5.4


Class: UniverInstanceService

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

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.

Extends

Implements

Constructors

new UniverInstanceService()

new UniverInstanceService(_injector, _contextService): UniverInstanceService

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

Parameters

ParameterType
_injectorInjector
_contextServiceIContextService

Returns

UniverInstanceService

Overrides

Disposable.constructor

Properties

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
_disposedprotectedbooleanfalse-Disposable._disposedpackages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:96
currentUnits$readonlyObservable<Map<number, Nullable<UnitModel>>>undefined--packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:142
focused$readonlyObservable<Nullable<string>>undefinedAn 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:234
unitAdded$readonlyObservable<UnitModel>undefinedOmits value when a new UnitModel is created.-packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:160
unitDisposed$readonlyObservable<UnitModel>undefinedOmits value when a UnitModel is disposed.-packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:194

Accessors

focused

Get Signature

get focused(): Nullable<UnitModel>

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

Returns

Nullable<UnitModel>

Methods

__setCreateHandler()

__setCreateHandler(handler): void

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

Parameters

ParameterType
handler(type, data, ctor, options?) => UnitModel

Returns

void


changeDoc()

changeDoc(unitId, doc): void

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

Parameters

ParameterType
unitIdstring
docDocumentDataModel

Returns

void

Deprecated

Implementation of

IUniverInstanceService.changeDoc


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:124

Create a unit with snapshot info.

Type Parameters

Type Parameter
T
U extends UnitModel

Parameters

ParameterType
typenumber
dataT
options?ICreateUnitOptions

Returns

U

Implementation of

IUniverInstanceService.createUnit


dispose()

dispose(): void

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

Returns

void

Overrides

Disposable.dispose


disposeUnit()

disposeUnit(unitId): boolean

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

Dispose a unit

Parameters

ParameterType
unitIdstring

Returns

boolean

Implementation of

IUniverInstanceService.disposeUnit


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

Disposable.ensureNotDisposed


focusUnit()

focusUnit(id): void

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

Focus a unit.

Parameters

ParameterType
idnull | string

Returns

void

Implementation of

IUniverInstanceService.focusUnit


getAllUnitsForType()

getAllUnitsForType<T>(type): T[]

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

Type Parameters

Type Parameter
T

Parameters

ParameterType
typenumber

Returns

T[]

Implementation of

IUniverInstanceService.getAllUnitsForType


getCurrentTypeOfUnit$()

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

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

Type Parameters

Type Parameter
T

Parameters

ParameterType
typenumber

Returns

Observable<Nullable<T>>

Implementation of

IUniverInstanceService.getCurrentTypeOfUnit$


getCurrentUnitForType()

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

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

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typenumber

Returns

Nullable<T>

Implementation of

IUniverInstanceService.getCurrentUnitForType


getCurrentUniverDocInstance()

getCurrentUniverDocInstance(): Nullable<DocumentDataModel>

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

Returns

Nullable<DocumentDataModel>

Deprecated

Implementation of

IUniverInstanceService.getCurrentUniverDocInstance


getFocusedUnit()

getFocusedUnit(): Nullable<UnitModel>

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

Returns

Nullable<UnitModel>

Implementation of

IUniverInstanceService.getFocusedUnit


getTypeOfUnitAdded$()

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

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

Subscribe to curtain type of units’ creation.

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typenumber

Returns

Observable<T>

Implementation of

IUniverInstanceService.getTypeOfUnitAdded$


getTypeOfUnitDisposed$()

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

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

Subscribe to curtain type of units’ disposing.

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typeUniverInstanceType

Returns

Observable<T>

Implementation of

IUniverInstanceService.getTypeOfUnitDisposed$


getUnit()

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

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

Type Parameters

Type ParameterDefault type
T extends UnitModelUnitModel

Parameters

ParameterType
idstring
type?number

Returns

Nullable<T>

Implementation of

IUniverInstanceService.getUnit


getUnitType()

getUnitType(unitId): UniverInstanceType

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

Parameters

ParameterType
unitIdstring

Returns

UniverInstanceType

Implementation of

IUniverInstanceService.getUnitType


getUniverDocInstance()

getUniverDocInstance(unitId): Nullable<DocumentDataModel>

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

Parameters

ParameterType
unitIdstring

Returns

Nullable<DocumentDataModel>

Deprecated

Implementation of

IUniverInstanceService.getUniverDocInstance


getUniverSheetInstance()

getUniverSheetInstance(unitId): Nullable<Workbook>

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

Parameters

ParameterType
unitIdstring

Returns

Nullable<Workbook>

Deprecated

Implementation of

IUniverInstanceService.getUniverSheetInstance


registerCtorForType()

registerCtorForType<T>(type, ctor): IDisposable

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

Type Parameters

Type Parameter
T extends UnitModel

Parameters

ParameterType
typenumber
ctor() => T

Returns

IDisposable

Implementation of

IUniverInstanceService.registerCtorForType


setCurrentUnitForType()

setCurrentUnitForType(unitId): void

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

Parameters

ParameterType
unitIdstring

Returns

void

Implementation of

IUniverInstanceService.setCurrentUnitForType