Why UI? Why Not?
Tuesday, November 27th, 2007I took some time over the long weekend to hunker down and get familiar with YUI, and re-familiar with javascript. I’m a dork. I know. But, i have to admit it’s been a while since i sat down and did something educational for myself.
Anyway, something to note about YUI is that, while incredibly powerful, it’s terribly documented. I mean, do i pass an id string or a reference to the html element? the examples are a mix/blur of both usages. Also, for those using the animation stuff, opacity is a value between 0 and 1, not 0 and 100. and you might also have to use a “from” attribute. oh, and you might also have to pre-initialize the opacity to match your “from”.
you see, i really don’t know cause i ended up shotgunning it cause,well, i spent one day setting up all the webservices i needed for this little app i’m building, and then the next four days trying to figure out how to mofo fade a damn li in and out.
also, one thing i have yet to figure out is javascript blocking/sleeping/waiting. i have an array that i want to iterate through and append li elements in a ul. the problem is that i want to append these elements over x amount of time, maybe, i dunno, one per second. however, i can’t seem to figure out how to sleep in javascript. anyone?



November 28th, 2007 at 9:48 am
try this: setTimeout (http://www.w3schools.com/htmldom/met_win_settimeout.asp)! =)
November 28th, 2007 at 2:09 pm
ant! you’re alive!
setTimeout isn’t cool for a couple reasons:
1) you can’t pass arguments to your callback function which means i’d have to export my array and index to a global context
2) the timeout parameter is absolute time. so, say i call setTimeout multiple times with 1000, 2000, and 3000, so we have a function set to fire off once per second. now the user goes to a new tab and loads a page which hogs all resources for three seconds. when the user returns to your page, then it’ll be clusterfuck of events firing off all at the same time.
what i really want is a chain effect. after you do x, then do y and so on. it looks like the only way to do this in js is to blow up the function stack buy continually recursing.