Skip to content

Instantly share code, notes, and snippets.

@Yuffster
Created April 15, 2012 02:30
Show Gist options
  • Select an option

  • Save Yuffster/2389413 to your computer and use it in GitHub Desktop.

Select an option

Save Yuffster/2389413 to your computer and use it in GitHub Desktop.
Eve.register('myAwesomePlugin', function() {
this.listen('a', 'click', function() {
console.log("You clicked on a link within my namespace!");
});
//Since no namespace is provided, this event will be triggered by
//any click events within the scoped namespace.
this.listen('click', function() {
alert("You clicked somewhere within my namespace!");
});
});
//Now, we're giving the module a scoped namespace to work with,
//effectively attaching events to "#section-of-my-site" and
//"#section-of-my-site a".
Eve.attach('myAwesomePlugin', '#section-of-site');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment