new DelayForwardController()
INTERNAL CODE DOCUMENTATION COMPLETE
Delayed Forward Controller
A Stimulus controller that provides automatic page redirection after a configurable delay. Useful for implementing splash screens, automatic redirects after form submissions, or timed navigation scenarios with user feedback periods.
Key Features:
- Configurable delay timing for redirect control
- Automatic cleanup to prevent memory leaks
- Timeout management with proper cancellation
- Immediate activation on controller connection
- Console logging for debugging redirect behavior
Extends
- Controller
Members
timeout :number|null
Timer reference for cleanup management
- number |
null
Methods
connect()
Initialize controller and start delayed forward process Automatically begins the redirect timer upon connection
disconnect()
Clean up timeout on controller disconnection Prevents redirect execution if controller is disconnected before timeout completes Essential for preventing memory leaks and unwanted redirects
forward()
Manage delayed redirect with timeout control Cancels any existing timeout before setting a new one to prevent multiple redirects Uses window.location.href for full page navigation