@univerjs/core v0.5.0-beta.1 • 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. | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:64 |
unitAdded$ | Observable <UnitModel <object , number >> | 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 <object , number >> | 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
Parameters
Parameter | Type |
---|---|
unitId | string |
doc | DocumentDataModel |
Returns
void
Deprecated
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:82
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
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:75
disposeUnit()
disposeUnit(unitId): boolean
Dispose a unit
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:77
focusUnit()
focusUnit(unitId): void
Focus a unit.
Parameters
Parameter | Type |
---|---|
unitId | null | string |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:66
getAllUnitsForType()
getAllUnitsForType<T>(type): T[]
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
T
[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:85
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
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:72
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
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:69
getCurrentUniverDocInstance()
getCurrentUniverDocInstance(): Nullable<DocumentDataModel>
Returns
Deprecated
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:93
getFocusedUnit()
getFocusedUnit(): 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:67
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
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:53
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
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:61
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
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:84
getUnitType()
getUnitType(unitId): number
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:86
getUniverDocInstance()
getUniverDocInstance(unitId): Nullable<DocumentDataModel>
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Deprecated
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:91
getUniverSheetInstance()
getUniverSheetInstance(unitId): Nullable<Workbook>
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Deprecated
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:89
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
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:79
setCurrentUnitForType()
setCurrentUnitForType(unitId): void
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/instance/instance.service.ts:70