flooding
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

flooding

NPM Version Node Version

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

Dependents (0)

Package Sidebar

Install

npm i flooding

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

8.18 kB

Total Files

5

Last publish

Collaborators

  • cooperhsiung