Members
online
Get current online status
Methods
bindHandler(name, handler) → {function}
Bind and track an event handler for later cleanup
| Name | Type | Description |
|---|---|---|
name | string | Identifier for the handler |
handler | function | Function to bind |
Bound handler
- Type:
- function
connect()
Connect controller to DOM Registers controller for connection state notifications
disconnect()
Disconnect controller from DOM Unregisters controller and cleans up event handlers
dispatchConnectionEvent(eventName, detail)
Dispatch a custom event with connection status
| Name | Type | Description |
|---|---|---|
eventName | string | Event name to dispatch |
detail | Object | Additional event detail |
(async) fetchWithRetry(url, options, retries, timeout) → {Promise.<Response>}
Fetch with retry logic and exponential backoff
| Name | Type | Default | Description |
|---|---|---|---|
url | string | URL to fetch | |
options | Object | Fetch options | |
retries | number | 3 | Number of retry attempts (default: 3) |
timeout | number | 10000 | Request timeout in ms (default: 10000) |
Fetch response
- Type:
- Promise.<Response>
getHandler(name) → {function|undefined}
Get a previously bound handler
| Name | Type | Description |
|---|---|---|
name | string | Handler identifier |
Bound handler or undefined
- Type:
- function |
undefined
initialize()
Initialize instance Sets up bound handler tracking map
onConnectionStateChanged(isOnline)
Override in subclass to handle connection state changes
| Name | Type | Description |
|---|---|---|
isOnline | boolean | Current connection state |
(static) initializeConnectionListeners()
Initialize static connection listeners once Sets up window online/offline event handlers
(static) notifyListeners(isOnline)
Notify all registered controllers of connection state change
| Name | Type | Description |
|---|---|---|
isOnline | boolean | Current connection state |
(static) setOnlineState(isOnline, notify)
Set global online state and optionally notify listeners.
| Name | Type | Default | Description |
|---|---|---|---|
isOnline | boolean | ||
notify | boolean | true |
(static) syncOnlineState()
Sync static isOnline with current navigator.onLine state Called on each controller connect to handle page loads while offline