GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ifakejs/easy-polling: 针对视频多屏播放需求: 轮巡策略,包括单路依次轮巡和多路同时轮巡.

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
__test__
__test__
 
 
scripts
scripts
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.eslintignore
.eslintignore
 
 
.eslintrc.js
.eslintrc.js
 
 
.gitignore
.gitignore
 
 
.prettierignore
.prettierignore
 
 
.prettierrc.js
.prettierrc.js
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
api-extractor.json
api-extractor.json
 
 
babel.config.js
babel.config.js
 
 
index.html
index.html
 
 
jest.config.js
jest.config.js
 
 
package.json
package.json
 
 
rollup.config.ts
rollup.config.ts
 
 
tsconfig.build.json
tsconfig.build.json
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.type.json
tsconfig.type.json
 
 

Repository files navigation

欢迎使用 @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

About

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

Resources

Readme
MIT license
Activity
Custom properties

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.