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
Parameter | Type |
---|---|
_injector | Injector |
_contextService | IContextService |
Returns
Overrides
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:96 |
currentUnits$ | readonly | Observable <Map <number , Nullable <UnitModel >>> | 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 > | 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 > | 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>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:235
Returns
Methods
__setCreateHandler()
__setCreateHandler(handler): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:120
Parameters
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
unitId | string |
doc | DocumentDataModel |
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
Parameter | Type |
---|---|
type | number |
data | T |
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
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
Parameter | Type |
---|---|
unitId | string |
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
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
ensureNotDisposed()
protected ensureNotDisposed(): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:103
Returns
void
Inherited from
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
Parameter | Type |
---|---|
id | null | 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
Parameter | Type |
---|---|
type | number |
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
Parameter | Type |
---|---|
type | number |
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
Parameter | Type |
---|---|
type | number |
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
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
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
Parameter | Type |
---|---|
type | number |
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
Parameter | Type |
---|---|
type | UniverInstanceType |
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 Parameter | Default type |
---|---|
T extends UnitModel | UnitModel |
Parameters
Parameter | Type |
---|---|
id | string |
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
Parameter | Type |
---|---|
unitId | string |
Returns
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
Parameter | Type |
---|---|
unitId | string |
Returns
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
Parameter | Type |
---|---|
unitId | string |
Returns
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
Parameter | Type |
---|---|
type | number |
ctor | () => T |
Returns
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
Parameter | Type |
---|---|
unitId | string |
Returns
void