Skip to content

Instantly share code, notes, and snippets.

@vilmibm
Created January 22, 2012 21:02
Show Gist options
  • Save vilmibm/1658771 to your computer and use it in GitHub Desktop.
Save vilmibm/1658771 to your computer and use it in GitHub Desktop.
marimo event example
medley_abuse_form.moderate = function() {
// AJAX for moderating a given object
this.emit('object_moderated');
};
medley_comments.render = function() {
// Render a template, put it on the page
this.on('object_moderated', function() {
this.refresh();
});
this.emit('comments_loaded');
};
// On can also listen for a list of events
yahoo_hp01_ad.render = function() {
this.on(['bundle_loaded', 'hp00_loaded'], function() {
// bundle is loaded, so we can process the ad
// needed to wait for hp00 to see if this widget
// should be centered
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment