Created
December 20, 2010 21:25
-
-
Save shawnbierman/749019 to your computer and use it in GitHub Desktop.
unsubscribing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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