@univerjs/core v0.4.2 • 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
submodules/univer/packages/core/src/services/instance/instance.service.ts:100 (opens in a new tab)
Properties
Accessors
focused
get focused(): Nullable<UnitModel<object, number>>
Returns
Nullable
<UnitModel
<object
, number
>>
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:235 (opens in a new tab)
Methods
__setCreateHandler()
__setCreateHandler(handler): void
Parameters
Parameter | Type |
---|---|
handler | (type , data , ctor , options ?) => UnitModel <object , number > |
Returns
void
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:120 (opens in a new tab)
changeDoc()
changeDoc(unitId, doc): void
Parameters
Parameter | Type |
---|---|
unitId | string |
doc | DocumentDataModel |
Returns
void
Deprecated
Implementation of
IUniverInstanceService
.changeDoc
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:221 (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 | T |
options ? | ICreateUnitOptions |
Returns
U
Implementation of
IUniverInstanceService
.createUnit
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:124 (opens in a new tab)
dispose()
dispose(): void
Returns
void
Overrides
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:107 (opens in a new tab)
disposeUnit()
disposeUnit(unitId): boolean
Dispose a unit
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
boolean
Implementation of
IUniverInstanceService
.disposeUnit
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:282 (opens in a new tab)
disposeWithMe()
disposeWithMe(disposable): IDisposable
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
Defined in
submodules/univer/packages/core/src/shared/lifecycle.ts:96 (opens in a new tab)
ensureNotDisposed()
protected ensureNotDisposed(): void
Returns
void
Inherited from
Defined in
submodules/univer/packages/core/src/shared/lifecycle.ts:100 (opens in a new tab)
focusUnit()
focusUnit(id): void
Focus a unit.
Parameters
Parameter | Type |
---|---|
id | null | string |
Returns
void
Implementation of
IUniverInstanceService
.focusUnit
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:242 (opens in a new tab)
getAllUnitsForType()
getAllUnitsForType<T>(type): T[]
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
type | number |
Returns
T
[]
Implementation of
IUniverInstanceService
.getAllUnitsForType
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:217 (opens in a new tab)
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
submodules/univer/packages/core/src/services/instance/instance.service.ts:143 (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
>
Implementation of
IUniverInstanceService
.getCurrentUnitForType
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:147 (opens in a new tab)
getCurrentUniverDocInstance()
getCurrentUniverDocInstance(): Nullable<DocumentDataModel>
Returns
Deprecated
Implementation of
IUniverInstanceService
.getCurrentUniverDocInstance
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:205 (opens in a new tab)
getFocusedUnit()
getFocusedUnit(): Nullable<UnitModel<object, number>>
Returns
Nullable
<UnitModel
<object
, number
>>
Implementation of
IUniverInstanceService
.getFocusedUnit
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:271 (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
>
Implementation of
IUniverInstanceService
.getTypeOfUnitAdded$
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:161 (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 | UniverInstanceType |
Returns
Observable
<T
>
Implementation of
IUniverInstanceService
.getTypeOfUnitDisposed$
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:195 (opens in a new tab)
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
submodules/univer/packages/core/src/services/instance/instance.service.ts:199 (opens in a new tab)
getUnitType()
getUnitType(unitId): UniverInstanceType
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Implementation of
IUniverInstanceService
.getUnitType
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:275 (opens in a new tab)
getUniverDocInstance()
getUniverDocInstance(unitId): Nullable<DocumentDataModel>
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Deprecated
Implementation of
IUniverInstanceService
.getUniverDocInstance
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:209 (opens in a new tab)
getUniverSheetInstance()
getUniverSheetInstance(unitId): Nullable<Workbook>
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
Deprecated
Implementation of
IUniverInstanceService
.getUniverSheetInstance
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:213 (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 | () => T |
Returns
Implementation of
IUniverInstanceService
.registerCtorForType
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:130 (opens in a new tab)
setCurrentUnitForType()
setCurrentUnitForType(unitId): void
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
void
Implementation of
IUniverInstanceService
.setCurrentUnitForType
Defined in
submodules/univer/packages/core/src/services/instance/instance.service.ts:151 (opens in a new tab)