Skip to main content

IntervalController

Purpose

Utility controller to wire up other controller actions that need to fire at set intervals.

Actions

ActionPurpose
--

Targets

TargetPurposeDefault
---

Classes

ClassPurposeDefault
---

Values

ValueTypeDescriptionDefault
secondsNumberThe number of seconds between each action-

Events

EventWhenDispatched onevent.detail
interval:actionFired every secondsValue seconds, used to wire your desired controller actions tothe controller root elementelement: the controller root element

Side Effects

Calls setInterval with the desired time value. Cleans up on disconnect.

How to Use

An example: Save the progress of your users through a particularly lengthy form every 30 seconds.

<form data-controller="form-save" data-action="interval:action->form-save#save">
<meta data-controller="interval" data-interval-seconds-value="30" />
</form>