OperationsManager

How to get OperationsManager

ES2015+:

import OperationsManager from 'fontoxml-operations/operationsManager'

ES5:

define([
	'fontoxml-operations/operationsManager'
], function (
	OperationsManager
) {
});

Type: Class

Operations control all interaction with the document and most state of the application. The operationManager manages the operations pipeline. It may execute operations and retrieve the state of an operation.

For more information on how to create operations, refer to the operations

Methods

Name Description
executeOperation

Execute the Operation with the specified operationName, optionally passing the specified initialData as its step data. Returns a promise that resolves to the resulting step data when the operation completes.

Code calling this method should always handle rejection, to prevent console errors about unhandled rejections.


  Arguments
# Name Type Description
1. operationName String
2. [initialData] StepData
3. isSubOperation Boolean

Only used internally, should NEVER be set to true manually.


  Default value
false
  Returns

Type: Promise<any>

May reject without a value to represent cancellation, or with a value to represent failure.

getOperationState

Compute the state of the operation with the specified operationName, optionally passing the specified initialData as its step data.

If resultAsStepData is true, this function returns the resulting step data with the operation state object under the operationState property.

Otherwise, directly returns the resulting state object.


  Arguments
# Name Type Description
1. operationName String
2. [initialData] StepData
3. resultAsStepData Boolean

For internal use only


  Default value
false
  Returns

Type: Promise<OperationState | StepData>

A promise to the state object, or the operation's last step data if resultAsStepData is true

invalidateOperationStateByOperationName

Cause the state of the given operation to be re-evaluated.

This will also re-evaluate the state of any operation that uses this operation.


  Arguments
# Name Type Description
1. operationName String
invalidateOperationStatesByStepType

Cause the state of any operation using the given step type to be re-evaluated.

This includes any operation using the step type indirectly through another operation.


  Arguments
# Name Type Description
1. requestedStepType String

the part of the type before the /

2. [requestedStepTypeInstance] String

the part of the type after the /