The runtime under which this saver is created.
The version of wed for which this object is created.
The updater that the editor created for its data tree.
The editor's data tree.
The object on which this class and subclasses may push new events.
The interval at which to autosave, in milliseconds.
The current timeout object which will trigger an autosave. It has the value
undefined
if there is no current timeout.
The generation that is currently being edited. It is mutable. Derived classes can read it but not modify it.
The editor's data tree.
The updater that the editor created for its data tree.
The observable on which clients can listen for events.
Subclasses must set this variable to true if the saver is in a failed state. Note that the "failed" state is for cases where it makes no sense to attempt a recovery operation.
One effect of being in a "failed" state is that the saver won't perform a recover operation if it is in a "failed" state.
Subclasses must set this variable to true once they have finished with their initialization.
The date of last modification.
The date of last save.
The last kind of save.
The runtime under which this saver is created.
The generation that has last been saved. Derived classes can read it but not modify it.
The version of wed for which this object is created.
This is the function called internally when an autosave is needed.
Must be called by derived classes when they fail to perform their task.
This method is called when recovering. This is the method responsible for the implementation-specific details.
A promise that resolves to true
if the recovery operation was
successful, and false
if not.
This method is called when saving or autosaving. This is the method responsible for the implementation-specific details.
true
if called by an autosave, false
if not.
Must be called by derived class upon a successful save.
true
if called for an autosave operation, false
if
not.
The generation being saved. It is necessary to pass this value due to the asynchronous nature of some saving operations.
This method returns the data to be saved in a save operation. Derived classes must call this method rather than get the data directly from the data tree.
Returns the last kind of save that occurred.
The kind. The value will be
undefined
if there has not been any save yet.
Returns information regarding whether the saver sees the data tree as having been modified since the last save occurred.
false
if the tree has not been modified. Otherwise, returns a
string that describes how long ago the modification happened.
Produces a string that indicates in human readable format when the last save occurred.
The string. The value undefined
is returned if no save has
occurred yet.
This method must be called before using the saver. MUST BE CALLED ONLY ONCE.
A promise that is resolved when the saver is initialized.
This method is to be used by wed upon encountering a fatal error. It will attempt to record the last state of the data tree before wed dies.
A promise which resolves to undefined
if the method did not do
anything because the Saver object is in an unintialized state or has
already failed. It resolves to true
if the recovery operation was
successful, and false
if not.
This method must be called when the user manually initiates a save.
A promise which resolves if the save was successful.
Changes the interval at which autosaves are performed. Note that calling this function will stop the current countdown and restart it from zero. If, for instance, the previous interval was 5 minutes, and 4 minutes had elapsed since the last save, the next autosave should happen one minute from now. However, if I now call this function with a new interval of 4 minutes, this will cause the next autosave to happen 4 minutes after the call, rather than one minute.
The interval between autosaves in milliseconds. 0 turns off autosaves.
Generated using TypeDoc
A saver is responsible for saving a document's data. This class cannot be instantiated as-is, but only through subclasses.