Skip to content

Instantly share code, notes, and snippets.

@oskarhane
Created January 29, 2017 20:51
Show Gist options
  • Save oskarhane/30cbd5d75c26eee24c9bd123acc5e7b1 to your computer and use it in GitHub Desktop.
Save oskarhane/30cbd5d75c26eee24c9bd123acc5e7b1 to your computer and use it in GitHub Desktop.
Basic suber usage
import { getBus } from 'suber'
const bus = getBus()
// Listen on channel / topic / action type
// and toggle the sidebar when something arrives
bus.take('TOGGLE_SIDEBAR', () => sidebar.toggle())
// In another part of the app
// send something on the 'TOGGLE_SIDEBAR' channel
bus.send('TOGGLE_SIDEBAR', null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment