@univerjscoreclassesFuniver

@univerjs/core v0.5.4


Class: FUniver

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:43

Extends

Extended by

Constructors

new FUniver()

new FUniver(
   _injector, 
   _commandService, 
   _univerInstanceService, 
   _lifecycleService): FUniver

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:65

Parameters

ParameterType
_injectorInjector
_commandServiceICommandService
_univerInstanceServiceIUniverInstanceService
_lifecycleServiceLifecycleService

Returns

FUniver

Overrides

FBaseInitialable.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_commandServicereadonlyICommandServiceundefined-packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:67
_disposedprotectedbooleanfalseFBaseInitialable._disposedpackages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:96
_eventRegistryprotectedMap<string, Registry<(param) => void>>undefined-packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:55
_injectorreadonlyInjectorundefinedFBaseInitialable._injectorpackages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:66
_lifecycleServicereadonlyLifecycleServiceundefined-packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:69
_univerInstanceServicereadonlyIUniverInstanceServiceundefined-packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:68

Accessors

Enum

Get Signature

get Enum(): FEnum

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:281

Returns

FEnum


Event

Get Signature

get Event(): FEventName

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:285

Returns

FEventName


Util

Get Signature

get Util(): FUtil

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:289

Returns

FUtil

Methods

_ensureEventRegistry()

protected _ensureEventRegistry(event): Registry<(param) => void>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:57

Parameters

ParameterType
eventstring

Returns

Registry<(param) => void>


_eventListend()

protected _eventListend(key): undefined | Registry<(param) => void>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:180

Parameters

ParameterType
keystring

Returns

undefined | Registry<(param) => void>


_initialize()

_initialize(injector): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-base.ts:66

Parameters

ParameterType
injectorInjector

Returns

void

Inherited from

FBaseInitialable._initialize


addEvent()

addEvent(event, callback): IDisposable

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:305

Add an event listener

Parameters

ParameterTypeDescription
eventkeyof IEventParamConfigkey of event
callback(params) => voidcallback when event triggered

Returns

IDisposable

The Disposable instance, for remove the listener

Example

univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
    console.log('unit created', params);
});

dispose()

dispose(): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FBaseInitialable.dispose


disposeUnit()

disposeUnit(unitId): boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:189

Dispose the UniverSheet by the unitId. The UniverSheet would be unload from the application.

Parameters

ParameterTypeDescription
unitIdstringThe unit id of the UniverSheet.

Returns

boolean

Whether the Univer instance is disposed successfully.


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FBaseInitialable.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FBaseInitialable.ensureNotDisposed


executeCommand()

executeCommand<P, R>(
   id, 
   params?, 
options?): Promise<R>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:249

Execute a command with the given id and parameters.

Type Parameters

Type ParameterDefault type
P extends objectobject
Rboolean

Parameters

ParameterTypeDescription
idstringIdentifier of the command.
params?PParameters of this execution.
options?IExecutionOptionsOptions of this execution.

Returns

Promise<R>

The result of the execution. It is a boolean value by default which indicates the command is executed.


fireEvent()

protected fireEvent<T>(event, params): undefined | boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:320

Fire an event, used in internal only.

Type Parameters

Type Parameter
T extends keyof IEventParamConfig

Parameters

ParameterTypeDescription
eventT{string} key of event
paramsIEventParamConfig[T]{any} params of event

Returns

undefined | boolean

should cancel

Example

this.fireEvent(univerAPI.event.UnitCreated, params);

getCurrentLifecycleStage()

getCurrentLifecycleStage(): LifecycleStages

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:197

Get the current lifecycle stage.

Returns

LifecycleStages

  • The current lifecycle stage.

getHooks()

getHooks(): FHooks

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:277

Get hooks.

Returns

FHooks

FHooks instance

Deprecated

use addEvent instead.


getUserManager()

getUserManager(): FUserManager

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:338

Returns

FUserManager


hasEventCallback()

protected hasEventCallback(event): boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:333

Get the callback map corresponding to the event

Parameters

ParameterType
eventkeyof IEventParamConfig

Returns

boolean

The number of callbacks


newBlob()

newBlob(): FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:350

Create a new blob.

Returns

FBlob

The new blob instance

Example

const blob = univerApi.newBlob();

newColor()

newColor(): ColorBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:362

Create a new color.

Returns

ColorBuilder

The new color instance

Example

const color = univerApi.newColor();

newParagraphStyle()

newParagraphStyle(style?): ParagraphStyleBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:401

Create a new paragraph style.

Parameters

ParameterTypeDescription
style?IParagraphStyleThe paragraph style

Returns

ParagraphStyleBuilder

The new paragraph style instance

Example

const paragraphStyle = univerApi.newParagraphStyle();

newParagraphStyleValue()

newParagraphStyleValue(style?): ParagraphStyleValue

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:414

Create a new paragraph style value.

Parameters

ParameterTypeDescription
style?IParagraphStyleThe paragraph style

Returns

ParagraphStyleValue

The new paragraph style value instance

Example

const paragraphStyleValue = univerApi.newParagraphStyleValue();

newRichText()

newRichText(data?): RichTextBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:375

Create a new rich text.

Parameters

ParameterType
data?IDocumentData

Returns

RichTextBuilder

The new rich text instance

Example

const richText = univerApi.newRichText();

newRichTextValue()

newRichTextValue(data): RichTextValue

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:388

Create a new rich text value.

Parameters

ParameterTypeDescription
dataIDocumentDataThe rich text data

Returns

RichTextValue

The new rich text value instance

Example

const richTextValue = univerApi.newRichTextValue();

newTextDecoration()

newTextDecoration(decoration?): TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:444

Parameters

ParameterType
decoration?ITextDecoration

Returns

TextDecorationBuilder


newTextStyle()

newTextStyle(style?): TextStyleBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:427

Create a new text style.

Parameters

ParameterTypeDescription
style?ITextStyleThe text style

Returns

TextStyleBuilder

The new text style instance

Example

const textStyle = univerApi.newTextStyle();

newTextStyleValue()

newTextStyleValue(style?): TextStyleValue

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:440

Create a new text style value.

Parameters

ParameterTypeDescription
style?ITextStyleThe text style

Returns

TextStyleValue

The new text style value instance

Example

const textStyleValue = univerApi.newTextStyleValue();

onBeforeCommandExecute()

onBeforeCommandExecute(callback): IDisposable

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:224

Register a callback that will be triggered before invoking a command.

Parameters

ParameterTypeDescription
callbackCommandListenerThe callback.

Returns

IDisposable

The disposable instance.

Deprecated

use addEvent(univerAPI.event.BeforeCommandExecute, () => {}) instead.


onCommandExecuted()

onCommandExecuted(callback): IDisposable

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:236

Register a callback that will be triggered when a command is invoked.

Parameters

ParameterTypeDescription
callbackCommandListenerThe callback.

Returns

IDisposable

The disposable instance.

Deprecated

use addEvent(univerAPI.event.CommandExecuted, () => {}) instead.


redo()

redo(): Promise<boolean>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:214

Redo an editing on the currently focused document.

Returns

Promise<boolean>

redo result


syncExecuteCommand()

syncExecuteCommand<P, R>(
   id, 
   params?, 
   options?): R

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:264

Execute a command with the given id and parameters synchronously.

Type Parameters

Type ParameterDefault type
P extends objectobject
Rboolean

Parameters

ParameterTypeDescription
idstringIdentifier of the command.
params?PParameters of this execution.
options?IExecutionOptionsOptions of this execution.

Returns

R

The result of the execution. It is a boolean value by default which indicates the command is executed.


undo()

undo(): Promise<boolean>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:206

Undo an editing on the currently focused document.

Returns

Promise<boolean>

undo result


extend()

static extend(source): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-base.ts:68

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FBaseInitialable.extend


newAPI()

static newAPI(wrapped): FUniver

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-univer.ts:50

Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.

Parameters

ParameterTypeDescription
wrappedInjector | UniverThe Univer instance or injector instance.

Returns

FUniver

  • The FUniver instance.

Static