# HG changeset patch # User wycc # Date 1302047533 -28800 # Node ID b8ba20b8f91a886d0eea0a711efa6fd2be696544 # Parent c918b79892ab627285062da0755205c03497576e Call onInitDOne when all pictures are loaded. diff -r c918b79892ab -r b8ba20b8f91a nodejs/examples/mce/epg.js --- a/nodejs/examples/mce/epg.js Wed Apr 06 07:51:06 2011 +0800 +++ b/nodejs/examples/mce/epg.js Wed Apr 06 07:52:13 2011 +0800 @@ -101,7 +101,9 @@ sys.puts("fetch "+ file); var u = URL.parse(url); var cachepath = 'cache/'+u.pathname; - if (isCached(cachepath,file,obj)) return; + if (isCached(cachepath,file,obj)) { + return; + } CreateDirectory(cachepath); // Fetch file from the server and convert it tyo PNG if it is not PNG format. @@ -145,6 +147,7 @@ obj.pend = obj.pend - 1; if (obj.pend == 0) { obj.onInitDone(); + sys.puts("done"); } }); @@ -159,7 +162,10 @@ for (i in cats) { c = cats[i]; httpGetFile(c['ProgramPIC'],'cat'+i+'.jpg',this); + sys.puts("this.pend="+this.pend); } + if (this.pend == 0) + this.onInitDone(); } EPG.prototype.getList=function(item,func) {