web-barrier-free
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

LICENSE js-standard-style NPM Version Build Status

web-barrier-free

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

简体中文

Install

Use npm

$ npm install web-barrier-free

or yarn

$ yarn add web-barrier-free

demo:

Use

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 2 ~ 0.1, default value: 1.

pitch

Intonation, range 2 ~ 0.1, default value: 1.

volume

Volume, range 2 ~ 0.1, 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 detailsMDN SpeechSynthesis

Problem

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.1
    18
    • latest

Version History

Package Sidebar

Install

npm i web-barrier-free

Weekly Downloads

21

Version

1.1.1

License

MIT

Unpacked Size

76.9 kB

Total Files

22

Last publish

Collaborators

  • ruilindong