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
Property | Type | Description | Defined 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
Parameter | Type |
---|---|
unitId | string |
doc | DocumentDataModel |
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
Parameter | Type |
---|---|
type | number |
data | Partial <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
Parameter | Type |
---|---|
unitId | string |
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
Parameter | Type |
---|---|
unitId | null | 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
Parameter | Type |
---|---|
type | number |
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
Parameter | Type |
---|---|
type | number |
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
Parameter | Type |
---|---|
type | number |
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
Deprecated
getFocusedUnit()
getFocusedUnit(): Nullable<UnitModel>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:67
Returns
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
Parameter | Type |
---|---|
type | number |
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
Parameter | Type |
---|---|
type | number |
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
Parameter | Type |
---|---|
id | string |
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
Parameter | Type |
---|---|
unitId | string |
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
Parameter | Type |
---|---|
unitId | string |
Returns
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
Parameter | Type |
---|---|
unitId | string |
Returns
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
Parameter | Type |
---|---|
type | number |
ctor | (…args ) => T |
Returns
setCurrentUnitForType()
setCurrentUnitForType(unitId): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:70
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
void