Skip to content

Instantly share code, notes, and snippets.

@shawnbierman
Created December 20, 2010 21:25
Show Gist options
  • Save shawnbierman/749019 to your computer and use it in GitHub Desktop.
Save shawnbierman/749019 to your computer and use it in GitHub Desktop.
unsubscribing
// Given the following namespaced objects
// a widget
Namespace('km.widget.edVolGraph', {
handle: 'undefined',
load: function() {
handle = $.subscribe('xmlFetch', function() {
// do stuff
});
}
});
// a controller
Namespace('km.core', {
url: 'someDir/someFile',
fetch: $.get(url, function(xml) {
$.publish('xmlFetch', [xml]);
})
});
// launching the widget
km.widget.edVolGraph.load(); // load into a view on main webpage
km.widget.edVolGraph.load(); // load into a view on main webpage
// if a user wants to kill just one of the views
// how can I unsubscribe that one view without
// unsubscribing the other(s)?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment