@univerjs/core v0.4.2 • Docs
Interface: IUniverInstanceService
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. | submodules/univer/packages/core/src/services/instance/instance.service.ts:64 (opens in a new tab) |
unitAdded$ | Observable <UnitModel <object , number >> | Omits value when a new UnitModel is created. | submodules/univer/packages/core/src/services/instance/instance.service.ts:51 (opens in a new tab) |
unitDisposed$ | Observable <UnitModel <object , number >> | Omits value when a UnitModel is disposed. | submodules/univer/packages/core/src/services/instance/instance.service.ts:59 (opens in a new tab) |
Methods
changeDoc()
changeDoc(unitId, doc): void
Parameters
Parameter | Type |
---|---|
unitId | string |
doc | DocumentDataModel |
Returns
void
Deprecated
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:82 (opens in a new tab)
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 | Partial <T > |
options ? | ICreateUnitOptions |
Returns
U
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:75 (opens in a new tab)
disposeUnit()
disposeUnit(unitId): boolean
Dispose a unit
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
boolean
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:77 (opens in a new tab)
focusUnit()
focusUnit(unitId): void
Focus a unit.
Parameters
Parameter | Type |
---|---|
unitId | null | string |
Returns
void
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:66 (opens in a new tab)
getAllUnitsForType()
getAllUnitsForType<T>(type): T[]
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
T
[]
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:85 (opens in a new tab)
getCurrentTypeOfUnit$()
getCurrentTypeOfUnit$<T>(type): Observable<Nullable<T>>
Type Parameters
Type Parameter |
---|
T extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
Observable
<Nullable
<T
>>
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:72 (opens in a new tab)
getCurrentUnitForType()
getCurrentUnitForType<T>(type): Nullable<T>
Type Parameters
Type Parameter |
---|
T extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
Nullable
<T
>
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:69 (opens in a new tab)
getCurrentUniverDocInstance()
getCurrentUniverDocInstance(): Nullable<DocumentDataModel>
Returns
Deprecated
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:93 (opens in a new tab)
getFocusedUnit()
getFocusedUnit(): Nullable<UnitModel<object, number>>
Returns
Nullable
<UnitModel
<object
, number
>>
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:67 (opens in a new tab)
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
>
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:53 (opens in a new tab)
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 | number |
Returns
Observable
<T
>
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:61 (opens in a new tab)
getUnit()
getUnit<T>(id, type?): Nullable<T>
Type Parameters
Type Parameter |
---|
T extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
id | string |
type ? | number |
Returns
Nullable
<T
>
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:84 (opens in a new tab)
getUnitType()
getUnitType(unitId): number
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
number
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:86 (opens in a new tab)
getUniverDocInstance()
getUniverDocInstance(unitId): Nullable<DocumentDataModel>
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Deprecated
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:91 (opens in a new tab)
getUniverSheetInstance()
getUniverSheetInstance(unitId): Nullable<Workbook>
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Deprecated
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:89 (opens in a new tab)
registerCtorForType()
registerCtorForType<T>(type, ctor): IDisposable
Type Parameters
Type Parameter |
---|
T extends UnitModel <object , number > |
Parameters
Parameter | Type |
---|---|
type | number |
ctor | (...args ) => T |
Returns
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:79 (opens in a new tab)
setCurrentUnitForType()
setCurrentUnitForType(unitId): void
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
void
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:70 (opens in a new tab)