Ruby's Louvre

每天学习一点点算法

导航

2011年9月13日 #

HTML5 预加载功能

摘要: HTML5对link的rel属性添加N多值,其中最有用的就是预加载功能了。它比网上提到图片预加载有时不同,它的加载时机是由浏览器决定的,只有在空闲时间才偷偷加载指定资源,防止一下子加载这么多东西把页面卡死。下面是MDC的说明Link prefetching is a browser mechanism, which utilizes browser idle time to download or prefetch documents that the user might visit in the near future. A web page provides a set of prefe 阅读全文

posted @ 2011-09-13 12:52 司徒正美 阅读(5031) 评论(4) 推荐(2) 编辑

javascript 让实例的方法都异步执行

摘要: var C = function(){ this._methodList = [];}C.prototype.fire = function(obj){ var instance = this; while(obj = this._methodList.shift()){ if(isFinite(obj.fn)){ var time = new Date; instance.timeoutID = setTimeout(function(){ instance.fire(); ... 阅读全文

posted @ 2011-09-13 10:30 司徒正美 阅读(1614) 评论(0) 推荐(0) 编辑