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