ExternalDataManager

Type: Class

How to get externalDataManager?

JavaScript

import externalDataManager from 'fontoxml-templated-views/src/externalDataManager.js'

Some templates need to render something not in the current document, or something that is derived from other data, which is expensive to compute. To be able to react to changes in this data, external data can be used in a template.

External data can only be retrieved while rendering, by using NodeProxy#getExternalValue. It should never be set during rendering or during XPath evaluation. Make sure to always call setExternalData asynchronously (e.g., from a Promise.then or setTimeout callback) to avoid errors.

Methods

setExternalData

Type: Function

Set a piece of external data and cause a rerender for any templated views depending on that data.

Note that internal mutations in the given value will not trigger view updates. It is therefore recommended to keep external values immutable and/or as flat as possible.

External data should never be set during rendering or during XPath evaluation. Always call this method asynchronously (e.g., from a Promise.then or setTimeout callback) to avoid errors.

Arguments