changeset 1409:b8ba20b8f91a

Call onInitDOne when all pictures are loaded.
author wycc
date Wed, 06 Apr 2011 07:52:13 +0800
parents c918b79892ab
children afa062941f39
files nodejs/examples/mce/epg.js
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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) {