Prototype 学习——PeriodicalExecuter对象
来源:互联网 发布:知羽电子相册模板 编辑:程序博客网 时间:2024/05/16 16:12
This is a simple facility for periodical execution of a function. This essentially encapsulates the native clearInterval
/setInterval
mechanism found in native Window
objects.
This is especially useful if you use one to interact with the user at given intervals (e.g. use a prompt
or confirm
call): this will avoid multiple message boxes all waiting to be actioned.
这个对象就是可以周期性的执行某个方法,但是在它内部维持了一个状态,可以防止由于某些原因一次调用没执行,然后下一次调用又来了,这样会造成连续执行两次方法。上面的第二断英文就是这个意思。
帮助文档上说这个对象只提供了一个方法stop,但是在我看的源码里还提供了一个事件onTimerEvent,应该可以在某个时候触发这个事件。但帮助文档上没有给出示例。
这个对象源码比较简单,这里直接贴出来了,就不再注释了:
看一下示例:
- Prototype 学习——PeriodicalExecuter对象
- Prototype 学习——Prototype对象
- Prototype 学习——Object对象
- Prototype 学习——Function对象
- Prototype 学习——Date对象
- Prototype 学习——Class对象
- Prototype 学习——RegExp对象
- Prototype 学习——ObjectRange对象
- Prototype 学习——Number对象
- Prototype 学习——Enumerable对象
- Prototype 学习——Template对象
- Prototype 学习——String对象
- Prototype 学习——Array对象
- Prototype 学习——Hash对象
- Prototype学习——Selector对象
- Javascript学习笔记(prototype对象)
- 设计模式学习(四) —— Prototype
- Prototype模式——设计模式学习
- 课程设计1
- inner join 用法
- "ImageShare” BT实例
- 热!热!热!
- Sample: dhtmlxTree Mixed checkboxes
- Prototype 学习——PeriodicalExecuter对象
- VisualBox中linux和windows共享文件设置
- Programming WCF Services - Transactions
- DB2数据库操作
- DllMain详解
- RFCOMM Chat 简单的BT聊天实例
- Java 集合类简述
- 在作缓存时使用SqlCacheDependency
- Modify HTML title tag 可以从这个例子得到启发如何修改DOM的元素