Skip to content

Instantly share code, notes, and snippets.

@chris001177
Created July 6, 2019 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris001177/7c59655cae6ecb6bd9a457cf23d19ef3 to your computer and use it in GitHub Desktop.
Save chris001177/7c59655cae6ecb6bd9a457cf23d19ef3 to your computer and use it in GitHub Desktop.
// Import the EventBus we just created.
import { EventBus } from './event-bus.js';
// The event handler function.
const clickHandler = function(clickCount) {
console.log(`Oh, that's nice. It's gotten ${clickCount} clicks! :)`)
}
// Listen to the event.
EventBus.$on('i-got-clicked', clickHandler);
// Stop listening.
EventBus.$off('i-got-clicked', clickHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment