MemberMobileCardPWA

MemberMobileCardPWA

MemberMobileCardPWA Stimulus Controller

Manages Progressive Web App (PWA) functionality for mobile member cards. Extends MobileControllerBase for centralized connection handling.

Features:

  • Service worker registration with version management
  • SW update detection and user notification
  • Online/offline status detection and display
  • URL caching for offline access
  • Visual status indicators with Bootstrap styling

Constructor

new MemberMobileCardPWA()

Source:

Methods

applyUpdate()

Description:
  • Apply the service worker update

Source:

createUpdateToast()

Description:
  • Create update toast element

Source:

dismissUpdate()

Description:
  • Dismiss update toast

Source:

dispatchStatusEvent()

Description:
  • Dispatch connection status event for other controllers

Source:

handleSwMessage()

Description:
  • Handle service worker messages (e.g., SW_UPDATED)

Source:

notifyServiceWorker()

Description:
  • Notify service worker of connection state

Source:

onConnect()

Description:
  • Connect controller - called after base class connect

Source:

onConnectionStateChanged()

Description:
  • Called when connection state changes (from base class)

Source:

onDisconnect()

Description:
  • Disconnect controller - called after base class disconnect

Source:

refreshPageIfOnline()

Description:
  • Refresh page if online

Source:

(async) registerServiceWorker()

Description:
  • Register service worker and set up message handling

Source:

showUpdateToast()

Description:
  • Show update available toast

Source:

statusTargetConnected()

Description:
  • Handle status target connection - ensures indicator is displayed correctly This fires when the target element is connected to the DOM, which handles Turbo page restoration where targets might connect after onConnect runs

Source:

updateStatusDisplay()

Description:
  • Update the status display indicator (simple circle)

Source:

urlCacheTargetConnected()

Description:
  • Handle URL cache target connection

Source:

waitForActive()

Description:
  • Wait for service worker to become active

Source: