Notifier

How to get Notifier

ES2015+:

import Notifier from 'fontoxml-utils/Notifier'

ES5:

define([
	'fontoxml-utils/Notifier'
], function (
	Notifier
) {
});

Type: Class

Creates a simple object which can be passed between the object that does the notifying and the object that is interested in receiving notifications.

Notifiers are usually created by managers, which usually uses a hook to integrate with changes happening inside the core editor and a execute notifier to inform interested parties of these changes (usually after having them parsed / processed first).

A notifier just executes its registered callbacks whenever executeCallbacks is called, it does not pass any contextual information to the callback. The callback can use other editor API methods to receive any context it might need.

Note that any error thrown by a callback is considered fatal, as it will prevent other callbacks from running, which leads to an inconsistent application state. If such an error is thrown, the application will redirect to the error route.

Methods

Name Description
addCallback

Adds the given callback to the notifier, it is executed when .executeCallbacks() is called.

Returns a function that may be called to remove the callback.


  Arguments
# Name Type Description
1. callback Function
  Returns

Type: Function

Related links