Class AutoSaveManager

Manager for automatically saving diagrams. The hook must be implemented.

const mgr = new AutoSaveManager(editor.graph);
mgr.save() {
GlobalConfig.logger.show();
GlobalConfig.logger.debug('save');
};

Hierarchy (view full)

Constructors

Properties

autoSaveDelay: number = 10

Minimum amount of seconds between two consecutive autosaves. Eg. a value of 1 (s) means the graph is not stored more than once per second. Default is 10.

autoSaveThreshold: number = 5

Minimum amount of ignored changes before an autosave. Eg. a value of 2 means after 2 change of the graph model the autosave will trigger if the condition below is true. Default is 5.

autoSaveThrottle: number = 2

Minimum amount of seconds between two consecutive autosaves triggered by more than changes within a timespan of less than seconds. Eg. a value of 1 (s) means the graph is not stored more than once per second even if there are more than changes within that timespan. Default is 2.

changeHandler: Function

Holds the function that handles graph model changes.

enabled: boolean = true

Specifies if event handling is enabled. Default is true.

eventListeners: EventListenerObject[] = []

Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

eventsEnabled: boolean = true

Specifies if events can be fired. Default is true.

eventSource: null | EventTarget = null

Optional source for events. Default is null.

graph: null | Graph = null

Reference to the enclosing Graph.

ignoredChanges: number = 0

Counter for ignored changes in autosave.

lastSnapshot: number = 0

Used for autosaving. See .

Methods

  • Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

    The parameters of the listener are the sender and an EventObject.

    Parameters

    • name: string
    • funct: Function

    Returns void

  • Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see Utils#bind).

    Example:

    fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))
    

    Parameters

    • evt: EventObject

      EventObject that represents the event.

    • sender: null | EventTarget = null

      Optional sender to be passed to the listener. Default value is the return value of .

    Returns void

  • Enables or disables event handling. This implementation updates .

    Parameters

    • value: boolean

    Returns void