模式 + GWT + Ajax = 易用性
2009-09-12 00:00:00 来源:WEB开发网清单 4. 预抓取模式伪代码
class_with_cache_and_pre-fetching code:
define class attributes for the cache (a hash map, array, whatever)
set the cache to empty
load_data method:
check if the asked data are already in the cache
if so,
get the data from the cache
perform whatever needs be done with it
otherwise,
display an appropriate "loading" message
call a server-side service to get the data
on callback:
put the data in the cache
if data were needed (as opposed to prefetched),
perform whatever needs be done with it
processing_data method:
call the load_data method to get that data
call the load_data method to get extra (prefetched) data
模式:线程模拟
现在考虑处理器密集型任务,比如处理大量 XML 或显示大量数据。如果任务花费的时间太长,用户就会收到消息:在 Firefox 浏览器上,“A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete”;在 Windows® Internet Explorer® 上,“Stop running this script? A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive”。更糟糕的是,如果用户注意到这个警告并停止脚本,那么实际上就取消了您的客户端程序!
- ››模式作用域:初级读本和最佳实践
- ››ajax调用后台页面怎样区别ID
- ››Ajax+jQuery实现LightBox与服务器通信
- ››AJAX中利用javascript的split函数处理responseTex...
- ››AjaXplorer 2.6.1 发布,远程文件管理
- ››AJAX + SVG 实现实时监控图表
- ››AJAX 及使用 E4X 编写 Web 服务脚本,第 2 部分:...
- ››AJAX也有安全隐患 谈谈AJAX的安全性
- ››ajax+asp.net+mssql无刷新聊天室
- ››AJAX中文问题[转]
- ››ajax如何将返回值赋值给js里面的变量们?
- ››ajax 在updatepanel中使用alert提示方法
更多精彩
赞助商链接