preferences Property

Description

This property is used to exchange user preferences between the ESD/SPD Web editor and the host application, which is responsible to persist this data as desired.

For example, the host application could save these preferences as a string with JSON.stringify, then read that string back and parse it into a JavaScript object with JSON.parse when starting up the editor.

The host application can then provide user-specific preference data across editor sessions. This data includes the user's editor preference settings and identification information for symbols that the user has identified as "favorites".

To retrieve and set this property, use the ESDWeb object's get and set methods, as illustrated below.

Example

editor = new ESDWeb(null, 'editorNode');

editor.startup(...);

/* Insert logic to read the persisted user data into userDataString */

var userData = JSON.parse(userDataString);
editor.set('preferences', userData);
		

In code that runs after the editor is closed:

// Retrieve user data from the editor
var userData = editor.get('preferences');

var userDataString = JSON.stringify(userData);

/* follow with additional logic to persist the user's data */