@bve/polling
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

安装

yarn add @bve/polling

or

npm install @bve/polling

用法

获取实例


  import Polling from '@bve/polling';

  // 默认 1000 毫秒
  const polling = new Polling(2000);

使用


// 开始
polling.start();

// 轮询执行
polling.add('getData', () => {
  console.log('getData'); 
});

// 延时轮询执行
polling.add('getData', async () => {
  await delay(5000);
  console.log('getData');
});

// 删除getData的轮询,如果不传则删除所有轮询
polling.del('getData');

// 停止轮询
polling.stop();

Readme

Keywords

none

Package Sidebar

Install

npm i @bve/polling

Weekly Downloads

2

Version

1.0.1

License

BSD-3-Clause

Unpacked Size

321 kB

Total Files

18

Last publish

Collaborators

  • shihuajunze