This controller can be put on body or any other element.
- Adds a websocket accessor to the element
- Controller exposes a
connectedboolean getter - Controller bails with a warning if no shared consumer is available
- Element will have
data-action-cable-connectedordata-action-cable-disconnectedattributes which can be used for CSS selectors - Element will emit
action-cable:connectedoraction-cable:disconnectedevents only when state is flipping - Errors => Disconnected to keep things simple
I intend to document the navigator.onLine accessor and the window:online/offline events so devs can handle PWA modes.
Seeking feedback on the following:
- is it within the realm of acceptable to ask people to import
consumerand assign it toapplication.consumer? - is it obnoxious for me to call this controller
websocket? - do you like the event handles and attribute names?