Skip to content

CodeMirrorEditor.operation method

CodeMirrorEditor › operation

Unofficial

Run a function as one batch of work, so the editor only reacts to what it did once it finishes. Nesting is allowed — only the outermost call ends the batch.

Signature:

operation(fn: () => T, force?: boolean | undefined): T

Parameters:

ParameterTypeDescription
fn() => TThe function to run.
force?boolean | undefinedWhether to start a batch even when one is already in progress.

Returns: TWhatever the function returned.


Unofficial

Execute a function as a single operation, batching view updates.

Signature:

operation(fn: () => T): T

Parameters:

ParameterTypeDescription
fn() => TThe function to execute.

Returns: TThe return value of the function.