[ 1 post ]

user2012yui

  • Username: user2012yui
  • Joined: Sun Jul 15, 2012 10:07 pm
  • Posts: 1
  • Offline
  • Profile
Tags:

Global ajax listener without use Y.publish for each sandbox

Post Posted: Sun Jul 15, 2012 10:19 pm
+0-
I am using YUI 3 and currently I know we can write a "global ajax listener" by putting publish before any io calls in each sandbox, like this:

Code:
YUI().use("io-base", function(Y){

    function onSuccess(transactionid,response,arguments){
        alert('start!');
    }
    Y.Global.on('io:start',onSuccess);

});

Y1 = YUI().use("io-base", "node", function(Y1){

    Y1.publish('io:start',{broadcast : 2});
    Y1.io("http://www.yahoo.com.hk");   

});


However, is there a better way that we don't have to put each Y.publish for each sandbox?

Any help will be appreciated, thanks.
  [ 1 post ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum