Whether the session is currently active
ReadonlycontextReadonlyhasReadonlyhasReadonlyhasReadonlyhasWhether to intercept the original event and show a confirmation dialog
The interval ID for the periodic pinging
The interval duration for the ping event
OptionallastThe last action button that triggered the event
ReadonlyrevisionThe hidden input to store the current revision created at datetime.
ReadonlyrevisionThe hidden input to store the current revision ID
ReadonlyunsavedThe checkbox input to indicate unsaved changes
ReadonlywThe confirmation dialog for overwriting changes made by another user
StaticblessingsStaticoutletsStatictargetsStaticvaluesButtons that will be intercepted to show the confirmation dialog.
Defaults to submit buttons and workflow action buttons in the edit form.
StaticshouldSet the interval for the periodic pinging, clearing the previous interval if it exists.
Clear the interval for the periodic pinging if one is set.
Proceed with the original action after the user confirms the dialog.
Dispatch the visibility state of the document. When used as an event
listener for the visibilitychange event, it will dispatch two separate
events: identifier:visible and identifier:hidden, which makes it easier
to attach event listeners to specific visibility states.
Clear the interval and prevent any pings from being dispatched until the session is resumed.
Dispatch a ping event, to be used by other controllers to keep the session alive or indicate presence.
Set the interval and allow pings to be dispatched again after the session has been paused.
Set the intercept value to 'network' (or remove it if already set) based on network-related events.
A network-related event containing a TypeError as detail.error
when the network is offline, otherwise the network is assumed to be back online.
Sets the unsaved changes input state based on the event type dispatched by the w-unsaved controller. If the event type is w-unsaved:add, the input is checked. If the event type is w-unsaved:clear, the input is unchecked.
w-unsaved:add or w-unsaved:clear
Intercept the original event and show a confirmation dialog instead.
The interception can be controlled dynamically via the interceptValue
so that we can temporarily disable it when the user confirms the overwrite
and immediately re-enable it without having to remove and re-add the event
listener. This is useful for events that are triggered by a multi-step
process, such as a workflow action, which may have its own dialogs and may
be cancelled in the middle of the process.
The original event that triggered the action.
Update the session state with the latest data from the server.
an event that contains JSON data in the detail property. Normally a w-swap:json event.
Staticafter
Manage an editing session by indicating the presence of the user and handling cases when there are multiple users editing the same content.
Remarks
This controller defines the following behaviors:
Ideally this controller should be used in conjunction with
SwapController,ActionController, andDialogControllerto compose the user experience.Example