Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capacitor/screen-reader

Package Overview
Dependencies
Maintainers
0
Versions
655
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor/screen-reader

The Screen Reader API provides access to TalkBack/VoiceOver/etc. and provides simple text-to-speech capabilities for visual accessibility.

  • 7.0.0-nightly-20241205T150544.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.1K
decreased by-11.82%
Maintainers
0
Weekly downloads
 
Created
Source

@capacitor/screen-reader

The Screen Reader API provides access to TalkBack/VoiceOver/etc. and provides simple text-to-speech capabilities for visual accessibility.

Install

npm install @capacitor/screen-reader
npx cap sync

Example

import { ScreenReader } from '@capacitor/screen-reader';

ScreenReader.addListener('stateChange', ({ value }) => {
  console.log(`Screen reader is now ${value ? 'on' : 'off'}`);
});

const checkScreenReaderEnabled = async () => {
  const { value } = await ScreenReader.isEnabled();

  console.log('Voice over enabled? ' + value);
};

const sayHello = async () => {
  await ScreenReader.speak({ value: 'Hello World!' });
};

API

  • isEnabled()
  • speak(...)
  • addListener('stateChange', ...)
  • removeAllListeners()
  • Interfaces
  • Type Aliases

isEnabled()

isEnabled() => Promise<{ value: boolean; }>

Whether a Screen Reader is currently active.

This method is not supported on web (it is not possible to detect Screen Readers).

Returns: Promise<{ value: boolean; }>

Since: 1.0.0


speak(...)

speak(options: SpeakOptions) => Promise<void>

Text-to-Speech functionality.

This function will only work if a Screen Reader is currently active.

On web, browsers must support the SpeechSynthesis API, or this method will throw an error.

For more text-to-speech capabilities, please see the Capacitor Community Text-to-Speech plugin.

ParamType
optionsSpeakOptions

Since: 1.0.0


addListener('stateChange', ...)

addListener(eventName: 'stateChange', listener: StateChangeListener) => Promise<PluginListenerHandle>

Add a listener for when the screen reader is turned on or off.

This event used to be named 'accessibilityScreenReaderStateChange'.

This method is not supported on web (it is not possible to detect Screen Readers).

ParamType
eventName'stateChange'
listenerStateChangeListener

Returns: Promise<PluginListenerHandle>

Since: 1.0.0


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all the listeners that are attached to this plugin.

Since: 1.0.0


Interfaces

SpeakOptions
PropTypeDescriptionSince
valuestringThe text to speak.1.0.0
languagestringThe language to speak the text in, as its ISO 639-1 Code (e.g.: "en"). This option is only supported on Android.1.0.0
PluginListenerHandle
PropType
remove() => Promise<void>
ScreenReaderState
PropTypeDescriptionSince
valuebooleanWhether a Screen Reader is currently active.1.0.0

Type Aliases

StateChangeListener

(state: ScreenReaderState): void

Keywords

FAQs

Package last updated on 05 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc