6. Outline
• Explain channels in more detail
• Show some examples of integration with React components
• Show how Flux can be re-envisioned with channels
22. ChannelsMixin
Adds send method
!
•Creates an event handler
•Takes a name and arguments
•If method exists with same name, simply forwards
events with supplied arguments
•Otherwise sends events onto a named channel
28. Channels
•mouseCoord channel instead of onMouseMove
event
•data extraction with transducer
•no dispatching required
•velocityRecord uses lexical scoping to keep
state
29. Benefits & Disadvantages
•Good: separation of concerns, modular
•Good: data flow as a first-class value
•Good: no leaking state
•Bad: Still more verbose
35. Takeaways
Using event handlers for simple events is fine
Channels allow more complex composition of
signals and async workflows
They also help separate related logic into a
single place
39. Notes about Flux
• Extracts out data into “one source of truth”
• Explicit forward flow
• Separates data into logical units
• Serves two purposes:
• Allows data dependencies
• Optimizes rendering
44. Potential Advantages
• Composability of event flows
• Cursor abstraction removes need for emitting
change events
• Potential global app state structure
• Component subscribing to events
45. Disadvantages
• Cursors can be invalidated easily, needs work
• Doesn’t enforce as much structure
• May not need any event composability