@univerjs/core v0.5.0-beta.1 • Docs
Class: UniverInstanceService
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
Parameters
Parameter | Type |
---|---|
_injector | Injector |
_contextService | IContextService |
Returns
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:100
Properties
Property | Modifier | Type | Default value | Description | Inherited from | Defined in |
---|---|---|---|---|---|---|
_disposed | protected | boolean | false | - | Disposable ._disposed | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:93 |
currentUnits$ | readonly | Observable <Map <number , Nullable <UnitModel <object , number >>>> | undefined | - | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:142 |
focused$ | readonly | Observable <Nullable <string >> | undefined | 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:234 |
unitAdded$ | readonly | Observable <UnitModel <object , number >> | undefined | Omits value when a new UnitModel is created. | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:160 |
unitDisposed$ | readonly | Observable <UnitModel <object , number >> | undefined | Omits 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<object, number>>
Returns
Nullable
<UnitModel
<object
, number
>>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:235
Methods
__setCreateHandler()
__setCreateHandler(handler): void
Parameters
Parameter | Type |
---|---|
handler | (type , data , ctor , options ?) => UnitModel <object , number > |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:120
changeDoc()
changeDoc(unitId, doc): void
Parameters
Parameter | Type |
---|---|
unitId | string |
doc | DocumentDataModel |
Returns
void
Deprecated
Implementation of
IUniverInstanceService
.changeDoc
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:221
createUnit()
createUnit<T, U>(
type,
data,
options?): U
Create a unit with snapshot info.
Type Parameters
Type Parameter |
---|
T |
U extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
type | number |
data | T |
options ? | ICreateUnitOptions |
Returns
U
Implementation of
IUniverInstanceService
.createUnit
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:124
dispose()
dispose(): void
Returns
void
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:107
disposeUnit()
disposeUnit(unitId): boolean
Dispose a unit
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
boolean
Implementation of
IUniverInstanceService
.disposeUnit
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:282
disposeWithMe()
disposeWithMe(disposable): IDisposable
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:96
ensureNotDisposed()
protected ensureNotDisposed(): void
Returns
void
Inherited from
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:100
focusUnit()
focusUnit(id): void
Focus a unit.
Parameters
Parameter | Type |
---|---|
id | null | string |
Returns
void
Implementation of
IUniverInstanceService
.focusUnit
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:242
getAllUnitsForType()
getAllUnitsForType<T>(type): T[]
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
T
[]
Implementation of
IUniverInstanceService
.getAllUnitsForType
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:217
getCurrentTypeOfUnit$()
getCurrentTypeOfUnit$<T>(type): Observable<Nullable<T>>
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
Observable
<Nullable
<T
>>
Implementation of
IUniverInstanceService
.getCurrentTypeOfUnit$
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:143
getCurrentUnitForType()
getCurrentUnitForType<T>(type): Nullable<T>
Type Parameters
Type Parameter |
---|
T extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
Nullable
<T
>
Implementation of
IUniverInstanceService
.getCurrentUnitForType
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:147
getCurrentUniverDocInstance()
getCurrentUniverDocInstance(): Nullable<DocumentDataModel>
Returns
Deprecated
Implementation of
IUniverInstanceService
.getCurrentUniverDocInstance
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:205
getFocusedUnit()
getFocusedUnit(): Nullable<UnitModel<object, number>>
Returns
Nullable
<UnitModel
<object
, number
>>
Implementation of
IUniverInstanceService
.getFocusedUnit
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:271
getTypeOfUnitAdded$()
getTypeOfUnitAdded$<T>(type): Observable<T>
Subscribe to curtain type of units’ creation.
Type Parameters
Type Parameter |
---|
T extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
Observable
<T
>
Implementation of
IUniverInstanceService
.getTypeOfUnitAdded$
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:161
getTypeOfUnitDisposed$()
getTypeOfUnitDisposed$<T>(type): Observable<T>
Subscribe to curtain type of units’ disposing.
Type Parameters
Type Parameter |
---|
T extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
type | UniverInstanceType |
Returns
Observable
<T
>
Implementation of
IUniverInstanceService
.getTypeOfUnitDisposed$
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:195
getUnit()
getUnit<T>(id, type?): Nullable<T>
Type Parameters
Type Parameter | Default type |
---|---|
T extends UnitModel <object , number > | UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
id | string |
type ? | number |
Returns
Nullable
<T
>
Implementation of
IUniverInstanceService
.getUnit
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:199
getUnitType()
getUnitType(unitId): UniverInstanceType
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Implementation of
IUniverInstanceService
.getUnitType
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:275
getUniverDocInstance()
getUniverDocInstance(unitId): Nullable<DocumentDataModel>
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Deprecated
Implementation of
IUniverInstanceService
.getUniverDocInstance
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:209
getUniverSheetInstance()
getUniverSheetInstance(unitId): Nullable<Workbook>
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Deprecated
Implementation of
IUniverInstanceService
.getUniverSheetInstance
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:213
registerCtorForType()
registerCtorForType<T>(type, ctor): IDisposable
Type Parameters
Type Parameter |
---|
T extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
type | number |
ctor | () => T |
Returns
Implementation of
IUniverInstanceService
.registerCtorForType
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:130
setCurrentUnitForType()
setCurrentUnitForType(unitId): void
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
void
Implementation of
IUniverInstanceService
.setCurrentUnitForType
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:151