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

wbf

v2.0.5

Published

[![LICENSE](https://img.shields.io/github/license/halodong/web-barrier-free?style=flat-square)](./LICENSE) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/halodong/web-barrier

Downloads

13

Readme

LICENSE js-standard-style NPM Version Build Status codecov

web-barrier-free

A JavaScript library that can help you quickly add accessible reading modes. Based on SpeechSynthesis API implementation.

简体中文

Install

Note: In version 2.0, the package name was changed to wbf

Use npm

$ npm install wbf

or yarn

$ yarn add wbf

demo:

Use

Example:

Wbf adopts the singleton design pattern, and it is recommended to use getInstance to create and obtain instances.

const options = {
  language: 'en',
  rate: 1,
  pitch: 1,
  readMode: 'finger'
}
const instance = Wbf.getInstance(options)
openBtn.addEventListener('click', () => {
  instance.open()
})

Options:

opening

A boolean value indicating whether the current state is on. defaults:false.

readMode

type readMode = 'finger' | 'continuous'

continuous: Continuous reading document.body.innerText. finger: Point to read, read the text of the element pointed by the mouse, the img tag will read the text of the alt attribute.

defaults:'finger'.

language

type language = 'en' | 'zh-CN'

Use language, the default value is'zh-CN'.

rate

Speaking rate, range 0.1 (lowest) ~ 10 (highest), default value: 1.

pitch

Intonation, range 0 (lowest) ~ 2 (highest), default value: 1.

volume

Volume, range 0 (lowest) and 1 (highest), default value: 1.

externalFn

You can provide an external reading text method externalFn instead of using the playAudio method provided by class Wbf.

needConsole

Whether the default console element is required, the default value is true.

Main JavaScript API

open

open Wbf's function.

open (): void;

close

close Wbf's function.

close (): void;

changeOptions

The function of modifying the Wbf attribute cannot modify the non-existing attribute and the opening attribute.

changeOptions (keyName: string, value): void;

changeMode

A function to modify the Wbf reading mode.

type readMode = 'finger' | 'continuous';
changeMode (readMode: readMode): void;

playAudio

A function to read a string.

playAudio (str: string): SpeechSynthesisUtterance | undefined

Compatibility

See for details MDN SpeechSynthesis

Problem

For bugs or suggestions, you can submit via create an issue. © 2021 GitHub, Inc.