Hi Amine,
The YUI Connection Manager also fires events:
http://yui.github.io/yui2/docs/yui_2.9.0_full/connection/index.html#customevents
Here is a little example:
import time
from nagare import component, presentation
class Counter(object):
def __init__(self):
self.v = 0
def increase(self):
time.sleep(3) # Take some times to complete
self.v += 1
@presentation.render_for(Counter)
def render(self, h, *args):
h << h.div(self.v)
h << h.a('++').action(self.increase)
return h.root
# ---
class App(object):
def __init__(self):
self.counter = component.Component(Counter())
@presentation.render_for(App)
def render(self, h, *args):
h << h.script('''
var YUC = YAHOO.util.Connect;
YUC.startEvent.subscribe(function(e) {
document.body.setAttribute("style", "background-color: #5C5C5C");
});
YUC.completeEvent.subscribe(function(e) {
document.body.removeAttribute("style");
});
''')
h << self.counter.render(h.AsyncRenderer())
return h.root
Best regards,
Alain
> Thanks