~/lightning

Syncing Component State Across Tabs with Service Workers

Lightningat React Conf 2018 · on Friday, 2018-10-26· [web-platform, react]
slides:none on file

A demo shows a concrete way to keep React component state identical across tabs without WebSockets by using a service worker message bus that receives state updates and broadcasts them. Implementation uses clients.matchAll to enumerate tabs, clients.matchAll + clientId filter to avoid echoing back to the sender, postMessage to push state, and a client-side listener plus post-to-worker calls on every increment/decrement. Demo is built, runs in modern browsers (not IE), and code is posted.

AI-written summary · about

  1. 0:00Intro
  2. 0:27About me
  3. 0:54Syncing Component State
  4. 1:35Service Workers
  5. 1:50Demo
  6. 2:46Service Worker
  7. 4:05Messaging Listener
  8. 4:46Recap
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.