Interval Looper

非同步数组枚举回调

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/3588/10916/Interval%20Looper.js

Aŭtoro
Jixun.Moe
Versio
0.0.1.20140725060155
Kreita
2014/07/24
Ĝisdatigita
2014/07/25
Licenco
N/A

数组循环

// 用法:
var loop = new IntervalLoop ([1, 2, 3], function (next, item) {
	$.ajax ({
		url: 'http://example.com/?id=' + item
	}).success (function (r) {
		// TODO: 处理抓取的数据
		// ...
		
		next ();
	});
}, 500).add (1, 2, 3).add (999).loop ();
 
// 监听事件更新
var xyz = document.addEventListener ('xyz', function (eve) {
	// TODO: 解析数据并传递需要的值
	loop.add(eve.target);
}, false);