beCodeMyFriend / Cuore.js

Other
34 stars 13 forks source link

handle multiple labels in a component #12

Closed elmendalerenda closed 12 years ago

elmendalerenda commented 12 years ago

TO CODE INTO COMPONENT: setLabelFromMessage: function(message){ var label = message.getFromAnswer('text'); var key = message.getFromAnswer('key');

    this.labels[key] = label;

    this.updateRender(); 
},

retrieveLabel: function(label) {
    this.addHandler('LABELS_getLabel_EXECUTED_' + label, new CUORE.Handlers.Executor('setLabelFromMessage'));
    CUORE.Bus.subscribe(this, 'LABELS_getLabel_EXECUTED_' + label);

    this.requestLabelText(label);
},

getText: function(key){
    return this.labels[key];
},