JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q41092F
  • License MIT

ClickTone is designed to control audio playback with various settings, including volume control, callback and debug mode. It also includes iOS support.

Package Exports

  • clicktone
  • clicktone/dist/index.js
  • clicktone/dist/index.module.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clicktone) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme


clicktone

npm GitHub package version NPM Downloads

ClickTone is designed to control audio playback with various settings, including volume control, callback and debug mode. It also includes iOS support.

850B gzipped

Demo


Install

yarn add clicktone

Import

import ClickTone from 'clicktone';

Usage

Class uses the Web Audio API, which supports many audio file formats: MP3, WAV, OGG, AAC and others. Please note that not all browsers support these formats.

const click = new ClickTone({
  file: './sound.mp3',
  volume: 0.7,
  throttle: 400,
  callback: () => { console.log('Playback ended') },
  debug: true,
});

myButton.addEventListener('click', () => click.play());

License

clicktone is released under MIT license.