¿ìËÙÒµÎñͨµÀ

ÓÃGoogle GearsÔöÇ¿ÄúµÄWebÓ¦ÓóÌÐò - ±à³ÌÈëÃÅÍø

×÷Õß ØýÃû¼¼Êõ À´Ô´ NET±à³Ì ä¯ÀÀ ·¢²¼Ê±¼ä 2012-06-15
¡¡function¡¡callWorker1 (){ ¡¡¡¡¡¡¡¡¡¡¡¡/*¡¡´´½¨Ò»¸ö×Ó¡¡Worker,¡¡µ÷ÓÃÍê¡¡ createWorkerFromUrl¡¡·½·¨ºó£¬ ¡¡¡¡¡¡¡¡¡¡¡¡¡¡*¡¡¸¸¡¡worker¡¡ºÍ×Ó¡¡ worker¡¡½«²¢ÐÐÔËÐУ¬µ±È»×Ó¡¡worker¡¡ÊÇÔÚºǫ́ÔËÐС¡¡¡¡¡ ¡¡¡¡¡¡¡¡¡¡ ¡¡¡¡*/¡¡ ¡¡¡¡¡¡¡¡¡¡¡¡var¡¡childWorkerId¡¡=¡¡ wp1.createWorkerFromUrl(''worker.js''); ¡¡¡¡¡¡¡¡¡¡¡¡//¡¡¸¸¡¡worker¡¡ ·¢ËÍÏûÏ¢¸ø×Ó¡¡worker ¡¡¡¡¡¡¡¡¡¡¡¡wp1.sendMessage(["Hello,",¡¡ {"gears":¡¡"Google¡¡Gears!"}],¡¡childWorkerId); ¡¡¡¡¡¡¡¡¡¡} ¡¡¡¡¡¡¡¡¡¡function¡¡callWorker2(){ ¡¡¡¡¡¡¡¡¡¡¡¡var¡¡ childWorkerId¡¡=¡¡wp2.createWorkerFromUrl(''worker.js''); ¡¡¡¡¡¡¡¡¡¡ ¡¡wp2.sendMessage(["ÄúºÃ¡¡,",¡¡{"gears":¡¡"ÊÀ½ç¡¡!"}],¡¡ childWorkerId); ¡¡¡¡¡¡¡¡¡¡} ¡¡¡¡¡¡¡¡</script> ¡¡¡¡</head> ¡¡¡¡<body> ¡¡¡¡¡¡¡¡<h1>Hello, ¡¡WorkerPool¡¡API</h1> ¡¡¡¡¡¡¡¡<input¡¡type="button"¡¡ value="WorkPool¡¡A¡¡Calls¡¡Child¡¡Worker" ¡¡¡¡¡¡¡¡¡¡¡¡ onclick="callWorker1();"> ¡¡¡¡¡¡¡¡<input¡¡type="button"¡¡ value="WorkPool¡¡B¡¡Calls¡¡Child¡¡Worker" ¡¡¡¡¡¡¡¡¡¡¡¡ onclick="callWorker2();"><hr/> ¡¡¡¡¡¡¡¡<div¡¡ id="msg"></div> ¡¡¡¡</body> </html> worker.js¡¡Îļþ¡¡ (function(){ ¡¡//¡¡×Ó¡¡worker¡¡¿ÉÒÔ ÔÚ´ËÖ´ÐмÆËãÁ¿ºÜ´óµÄ´úÂë })(); var¡¡wp¡¡=¡¡ google.gears.workerPool; wp.onmessage¡¡=¡¡function(a,¡¡b,¡¡ message)¡¡{ ¡¡¡¡var¡¡reply¡¡=¡¡"This¡¡is¡¡reply¡¡message¡¡from¡¡ child¡¡work:" ¡¡¡¡¡¡¡¡+¡¡message.body[0] ¡¡¡¡¡¡¡¡+¡¡ message.body[1].gears; ¡¡¡¡wp.sendMessage(reply,¡¡ message.sender); }

ÓÃGoogle GearsÔöÇ¿ÄúµÄWebÓ¦ÓóÌÐò(6)

ʱ¼ä:2011-08-27 IBM ¸µ·É ¹ÅÁ¦

WorkerPool ²»Êǵ¥Àý¶ÔÏó£¬ËùÒÔ¿ÉÒÔ ¿´µ½ÔÚÉÏÃæµÄ¸¸Ò³ÃæÖпÉÒÔ´´½¨Á½¸ö WorkerPool¡£ÔÚ¸¸Ò³ÃæµÄ Javascript ´úÂë Ï൱ÓÚ¸¸ worker, Äã¿ÉÒÔÓà WorkerPool ¶ÔÏóµÄ createWorkerFromUrl() ·½·¨ ´´½¨Ò»¸ö×Ó worker, ¸Ã·½·¨µÄ²ÎÊýÊÇ JavaScript ÎļþµÄ URL, Ò²¿ÉÒÔÓà createWorker() ·½·¨´´½¨£¬²ÎÊýÊÇÒ»¶Î JavaScript ´úÂë¡£´´½¨Íê×Ó worker Ö® ºó£¬¸¸ worker ºÍ×Ó worker ½«²¢ÐÐÔËÐÐ , ×Ó worker ÔÚºǫ́³Ðµ£¼ÆËãÁ¿´óµÄÈÎ Îñ£¬¶ø¸¸ worker ÔÚÇ°Ãæ¼ÌÐøÏìÓ¦´¦ÀíÓû§²Ù×÷¡£

ÁíÍ⣬ÓÉÓÚ WorkerPool ¸üÏñÊÇÒ»¸ö½ø³Ì³Ø£¬¶ø²»ÊÇÏ̳߳أ¬ËùÒÔ worker Ö®¼ä²»¹²ÏíÖ´ÐÐ×´ ̬£¬ËûÃÇÖ®¼äµÄÏ໥ͨѶֻÄÜͨ¹ýÏûÏ¢´«µÝ£¬Ò²¾ÍÊǵ÷Óà WorkerPool ¶ÔÏóµÄ sendMessage() ·½·¨£¬¸Ã·½·¨ÓÐÁ½¸ö²ÎÊý£º

µÚÒ»¸ö²ÎÊýÊÇÒª´«µÝµÄÏûÏ¢ÄÚ ÈÝ¡£

µÚ¶þ¸ö²ÎÊýÊǽÓÊܸÃÏûÏ¢µÄ worker µÄ ID£¬WorkerPool ¶ÔÏóµÄÁ½¸ö ·½·¨ createWorkerFromUrl() ºÍ createWorker() ·µ»ØµÄ¾ÍÊÇ´´½¨µÄ×Ó worker µÄ ID, ¿ÉÒÔÓÃÀ´×÷Ϊ¸Ã²ÎÊýµÄÖµ¡£

²»¹ÜÊǸ¸ worker »¹ÊÇ×Ó worker, Òª ÏëµÃµ½ sendMessage() ·½·¨´«¹ýÀ´µÄÏûÏ¢£¬¶¼ÐèÒªÊÂÏȶ¨Òå»Øµ÷º¯Êý onmessage £¬ÓÃÓÚ´¦Àí½ÓÊÕµ½µÄÏûÏ¢¡£

ÕýÊÇÓÉÓÚ WorkerPool Ö®¼ä²»¹²ÏíÖ´ÐÐ״̬£¬ ×÷Ϊ½á¹û£¬×Ó worker ²»ÄÜ·ÃÎʸ¸Ò³ÃæµÄ DOM£¬ÒÔ¼° document, window ÕâÑùµÄ ¶ÔÏó£¬Ö»Óи¸ worker ÄÜ·ÃÎÊÕâЩ¶ÔÏó¡£Èç¹û×ÓÒ³ÃæÒª·ÃÎÊÕâЩ¶ÔÏ󣬿ÉÒÔͨ¹ý ¸ø¸¸ worker ·¢ÏûÏ¢Èø¸ worker À´·ÃÎÊ¡£µ«ÊÇ£¬×Ó worker »¹ÊÇÄܵ÷Óà JavaScript µÄÄÚÖú¯ÊýºÍ´ó²¿·Ö Google Gears API¡£

ʹÓà Database API

ΪÁËÈà Web Ó¦ÓóÌÐòÖ§³ÖÀëÏß²Ù×÷£¬Ê×ÏÈÐèÒª½â¾öµÄÎÊÌâÊǽ« Web Ó¦ÓóÌÐò°üº¬µÄ HTT

ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»!

·ÖÏíµ½£º ¸ü¶à
Äã¿ÉÄܶÔÏÂÃæµÄÎÄÕ¸ÐÐËȤ
HTTP/1.1 401 Access Denied æÖƸ߹âË®¾§ÖʸÐË®¾§Æ»¹û" target="_blank">Photoshop»æÖƸ߹âË®¾§ÖʸÐË®¾§Æ»¹û

Copyright ©1999-2011 ÏÃÃÅÁèÖڿƼ¼ÓÐÏÞ¹«Ë¾ ÏÃÃÅÓÅͨ»¥Áª¿Æ¼¼¿ª·¢ÓÐÏÞ¹«Ë¾ All rights reserved

µØÖ·(ADD)£ºÏÃÃÅÈí¼þÔ°¶þÆÚÍûº£Â·63ºÅ701E£¨¶«ÄÏÈÚͨÅÔ£© Óʱà(ZIP)£º361008

µç»°£º0592-5908028 ´«Õ棺0592-5908039 ×ÉѯÐÅÏ䣺web@lingzhong.cn ×ÉѯOICQ£º173723134

¡¶ÖлªÈËÃñ¹²ºÍ¹úÔöÖµµçÐÅÒµÎñ¾­ÓªÐí¿ÉÖ¤¡·ÃöB2-20100024  ICP±¸°¸:ÃöICP±¸05037997ºÅ