DogDay
12-20-2010, 09:35 PM
Hello,
I am having some issues using $.unsubscribe() when I have two or more instances of like subscribers. Anyone care to take a crack at it, please?
Thanks. same code on GitHUB (https://gist.github.com/749019)
// 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)?
I am having some issues using $.unsubscribe() when I have two or more instances of like subscribers. Anyone care to take a crack at it, please?
Thanks. same code on GitHUB (https://gist.github.com/749019)
// 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)?