FEventName
| packages | @univerjs/core |
|---|
APIs
BeforeCommandExecute
Event fired before a command is executed
Signature
get BeforeCommandExecute(): "BeforeCommandExecute"Tags
@see— ICommandEvent
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {
const { params, id, type, options } = event
console.log('before command executed', event)
// Cancel the command execution
event.cancel = true
})
// Remove the event listener, use `disposable.dispose()`BeforeRedo
Event fired before a redo command is executed
Signature
get BeforeRedo(): "BeforeRedo"Tags
@see— ICommandEvent
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {
const { params, id, type } = event
console.log('before redo command executed', event)
// Cancel the redo operation
event.cancel = true
})
// Remove the event listener, use `disposable.dispose()`BeforeUndo
Event fired before an undo command is executed
Signature
get BeforeUndo(): "BeforeUndo"Tags
@see— ICommandEvent
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {
const { params, id, type } = event
console.log('before undo command executed', event)
// Cancel the undo operation
event.cancel = true
})
// Remove the event listener, use `disposable.dispose()`CommandExecuted
Event fired when a command is executed
Signature
get CommandExecuted(): "CommandExecuted"Tags
@see— ICommandEvent
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
const { params, id, type, options } = event
console.log('command executed', event)
})
// Remove the event listener, use `disposable.dispose()`DocCreated
Event fired when a document is created
Signature
get DocCreated(): "DocCreated"Tags
@see— IDocCreatedParam
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.DocCreated, (params) => {
const { unitId, type, doc, unit } = params
console.log('doc created', params)
})
// Remove the event listener, use `disposable.dispose()`DocDisposed
Event fired when a document is disposed
Signature
get DocDisposed(): "DocDisposed"Tags
@see— IDocDisposedEvent
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.DocDisposed, (params) => {
const { unitId, unitType, snapshot } = params
console.log('doc disposed', params)
})
// Remove the event listener, use `disposable.dispose()`get
Signature
static get(): import("/Users/jikkai/Dev/univer/packages/core/src/facade/f-event").FEventNameLifeCycleChanged
Event fired when life cycle is changed
Signature
get LifeCycleChanged(): "LifeCycleChanged"Tags
@see— ILifeCycleChangedEvent
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
const { stage } = params
console.log('life cycle changed', params)
})
// Remove the event listener, use `disposable.dispose()`Redo
Event fired when a redo command is executed
Signature
get Redo(): "Redo"Tags
@see— ICommandEvent
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.Redo, (event) => {
const { params, id, type } = event
console.log('redo command executed', event)
})
// Remove the event listener, use `disposable.dispose()`Undo
Event fired when an undo command is executed
Signature
get Undo(): "Undo"Tags
@see— ICommandEvent
Examples
const disposable = univerAPI.addEvent(univerAPI.Event.Undo, (event) => {
const { params, id, type } = event
console.log('undo command executed', event)
})
// Remove the event listener, use `disposable.dispose()`