InitialDocumentsManager

How to get InitialDocumentsManager

ES2015+:

import InitialDocumentsManager from 'fontoxml-remote-documents/initialDocumentsManager'

ES5:

define([
	'fontoxml-remote-documents/initialDocumentsManager'
], function (
	InitialDocumentsManager
) {
});

Type: Class

The InitialDocumentsManager provides an interface to load, unload and reload the documents to be shown in the editor. Various implementations of these functions exist that modify the DocumentsHierarchy in different ways. This manager uncouples other code from the specifics of those implementations.

It also provides a notifier to signal when the initial documents have loaded.

Properties

Name Type Description
initialDocumentsLoadedNotifier Notifier

Invoked after the initial documents have loaded

Methods

Name Description
setLoadingStrategy

Set the functions to use for loading, unloading and reloading the documents to be used in the editor.


  Arguments
# Name Type Description
1. loadInitialDocuments Function

called with an array of remote document IDs parsed from the scope should return a Promise which resolves when loading is completed

2. unloadDocuments Function

called when the user leaves the editor route to clean up all documents loaded during the initial load as well as any subsequent operations.

3. reloadDocument Function

called with a local document ID when a document needs to be reloaded, for instance when locking the document fails. Should return a Promise that resolves to the new document ID when loading completes.

4. [retryLoadingDocumentForHierarchyNode] Function

called with a DocumentsHierarchyNode to retry loading documents on demand if the initial load failed for any reason. Should return a Promise that resolves when loading completes.