flooding
v1.0.2
Published
make a function to execute like flooding
Downloads
12
Readme
flooding
make a function to execute like flooding, suitable for ticket-snatching tasks.
适用于执行抢票任务
Installation
npm i flooding -S
Usage
import flooding from 'flooding';
function run() {
console.log('run at:', new Date());
// your tasks
}
flooding(run, {
fireAt: '2019-09-24 15:01:00',
frames: [30, 20, 10, 5, 3, 2, 1]
});
API
flooding(run: Function, options: {
fireAt: string; // 票券发售时刻
frames: number[]; // 倒计时刻开始执行任务,尾部执行频率加快
expiry?: number; // 超过 fireAt 多久停止任务,默认 60s
}):void
Todo
- [ ] xxxx
License
MIT