Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    unsubscribing using pubsub

    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

    Code:
    // 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)?

  • #2
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is there no one?

    Surely someone can at least tell me if I'm just trying to re-invent the wheel and that I should try x method?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •