Search

11/11/2008

Plank - Lang's little gems

Plank - Lang's little gems

 YAHOO.lang.substitute('Hello {world}', {'world':'earth'});  


var foo = {
count :0,
'method' : function(data) {
this.count++;
if(this.count == 10) {
timer.cancel();
}
console.log(this.count);
}
}
var timer = YAHOO.lang.later(1000, foo, 'method', [{data:'bar', data2:'zeta'}], true);


var myAwesomelWidget = function(oConfigs) {
oConfigs = oConfigs || {};
var defaults = {
'awesomeness' : '11',
'shiny' : 'high',
'sparkle' : 'high'
}
var combinedConfigs = YAHOO.lang.merge(defaults, oConfigs);
//Shiny is now set to low, everything else in combinedConfigs is set to the defaults
};
myAwesomelWidget({'shiny': 'low'});`

Ajaxian » Reminded of speaking your YAHOO.lang

沒有留言: