Whether autosave is active.
Autosave may be deactivated when there is an unrecoverable error, e.g. a newer revision is detected.
ReadonlycontextReadonlyhasThe debounce interval between autosave calls, in milliseconds.
OptionallastThe last event that triggered a save, used to ensure that if multiple saves are triggered while a save is still in progress, only one additional save will be triggered after the first one finishes, and it will use the latest event's data.
This is necessary to prevent multiple saves from being triggered in quick succession and overwhelming the server, while still ensuring that the latest data is saved.
It is reset after each save finishes, and if it has changed during the save, another save will be immediately triggered with the latest event.
ReadonlypartialsThe target element for partial HTML updates.
The timer before retrying a save request that failed due to a network error. Increases 2 seconds exponentially to the power of AutosaveController.retryTimes.
The number of times the current save request has been retried. Limited to AutosaveController.maxRetries.
The current revision ID of the form being edited.
The current state of the autosave process.
This is only set when the controller is used as an indicator component, not when controlling a form.
Handles the submission of the autosave form.
Debouncible based on the interval value.
The promise of the currently running save request, if any. Used to prevent multiple concurrent save requests, which can cause race conditions and other unintended consequences.
StaticblessingsStaticmaxMaximum number of attempts to retry a save request that failed due to a network error. See AutosaveController.retryTimes.
StaticoutletsStatictargetsStaticvaluesStaticshouldResets retry state so future retries start with the initial delay.
Fetches the given URL that returns the partials needed to hydrate a create view into an edit view, and put it into the partials target.
A CustomEvent containing the URL to fetch.
Applies the new debounce interval to the submit function.
Updates the indicator component's state based on events dispatched by the controller from the editor form.
Staticafter
Sends a form's data to the server for autosaving.
Can also be used for an indicator component to show the current autosave state.
Dispatches the following events.
Fires
w-autosave:save- before saving, cancelable.Fires
w-autosave:hydrate- to hydrate a create view into an edit view.Fires
w-autosave:success- on successful save and any UI updates.Fires
w-autosave:error- on save error, e.g. due to validation errors.Fires
w-autosave:deactivated- when autosave is deactivated due to an unrecoverable error.