用Mootools实现一个Ajax队列
因一个项目需要使用Javascript来实现一个排队机制,等上一个队列处理完毕之后,再执行下一个请求。下面是我用Mootools 实现的一个简单的队列Demo. 队列主文件: 来自Trickerise Request.implement({ queue: function(sendArg){ if(!$defined(this.queued)) this.queued = []; this.queued.push(sendArg); this.processQueue(); }, processQueue: function(){ if(this.timer) $clear(this.timer); if (!this.check()) this.timer = this.processQueue.delay(250, this); else { if ($defined(this.queued[0])) { this.send(this.queued.shift()); this.processQueue(); } else this.fireEvent('onQueueEmpty'); } } }); 页面执行代码: window.addEvent('domready', function()...
- 聚合来源
-
- 携程UED
- 帕兰映像
- caoz - 曹政
- Hmilyld - 胡志刚的Blog
- Angelk7
- Riix - 熊睿
- 迅雷UED
- 35UI团队
- 阻击者 - 邱松
- 金蝶UED
- Blueidea Xml News Aggregator
- 163 UED Team
- PPQ's Sky
- 灰灰菜的blog
- 凉爽的blog
- Simple.Style
- Liuyang | BlogLife
- WE17 | 我们一起
- 李方明 - mixfog
- kidaubis' blog
- Daxiong's Note
- Sluke的夹生饭
- Sin.CS 的 Blog - kingcms
- Clinch's Blog
- Moying - 鸡腿日志
- 邱南奇_Qiunanqi.com
- 莫丢 一滚天地开
- 阿飞@1982Y.com
- 碳酸氢钠|NaHCO3^Web Home
- 墨@猫一样的懒女人
- L4EVER.CN 简单快乐
- tension's blog
- 幻想曲.Net
- 千鸟志
- JJ.Ying's GUI World
- 4ngel's blog
- 膘叔 簡單人生
- 龙龙 钟爱梦欣
- 资源搜索
- 24小时热门
-
- 一周热门
-
