npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ifake/easy-polling

v1.1.0

Published

![Version](https://img.shields.io/npm/v/@ifake/easy-polling) ![Npm Bundle Size](https://img.shields.io/bundlephobia/min/@ifake/easy-polling) ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)

Downloads

6

Readme

欢迎使用 @ifake/easy-polling 👋

Version Npm Bundle Size License: MIT

针对视频多屏播放需求: 轮巡策略,包括单路依次轮巡和多路同时轮巡..

本项目的脚手架来自 pkg

🏠 Homepage

安装

npm install @ifake/easy-polling

# or
yarn add @ifake/easy-polling

使用

  • 浏览器端
// 我们提供了一个全局变量 `EasyPolling` 以便使用CDN时直接在浏览器端使用.
const EasyPolling = window.EasyPolling
  • ES6 Module
import { EasyPolling } from "@ifake/easy-polling"

DEMO

import { EasyPolling } from "@ifake/easy-polling"

const instance = new EasyPolling({
  source: [param1, param2, param3...],
  intervalTime: 2000
  type: 'single' || 'double'
  returnCount: 2
})
instance.observe((data) => {
})
instance.start()
// stop
instance.stop()

// update intervalTime
instance.updateIntervalTime(5000)

本地运行

git clone https://github.com/ifakejs/easy-polling.git

cd easy-polling

yarn

yarn start

// 新打开命令行
yarn start:demo

API

EasyPolling [Class]

  • 参数
type RunType = "single" | "double"

interface EasyPollingOptions {
  type: RunType // polling type
  source: any[] // Data source
  intervalTime: number // ms
  returnCount: number // 返回的数据(每次展示几屏)个数
  replaceCount: number // 仅在single模式生效 每次替换几个视频
}

方法

方法 | 类型 | 描述 | 返回值 ----- | ----- | ----- | ----- start | Function | 开始轮巡 | - stop | Function | 结束轮巡g | - observe | Function | 订阅轮巡数据 | data[] updateIntervalTime | Function | 更新轮巡周期 | -

注意事项

请在observe之后调用start方法,因为在调用轮巡策略时内部我们有初始数据的逻辑 否则,将丢失初始回调数据。

e.g

# 正确用法
instance.observe(() => {})
instance.start()

作者

👤 BiYuqi

🤝 贡献

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator