Greasy Fork is available in English.

Interval Looper

非同步数组枚举回调

Questo script non dovrebbe essere installato direttamente. È una libreria per altri script da includere con la chiave // @require https://update.greasyfork.org/scripts/3588/10916/Interval%20Looper.js

Autore
Jixun.Moe
Versione
0.0.1.20140725060155
Creato il
24/07/2014
Aggiornato il
25/07/2014
Licenza
Non disponibile

数组循环

// 用法:
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);