preferences Property

Description

This property is used to exchange user preferences between the Web SDK 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".

Use the get and set methods of the ESDWeb object to get and set the value of this property as illustrated below.

Example

editor = new window.__editor(undefined, document.getElementById('editor-node'));

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 */