clicktone 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +17 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -31,20 +31,33 @@ import ClickTone from 'clicktone';
31
31
 
32
32
  ➤ **Usage**
33
33
 
34
- <sub>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.</sub>
34
+ <sub>ClickTone uses the Web Audio API, which supports many audio file formats: MP3, WAV, OGG, AAC and others. Note that not all browsers support these formats.</sub>
35
35
  ```javascript
36
- const click = new ClickTone({
36
+ const sound = new ClickTone({
37
37
  file: './sound.mp3',
38
38
  volume: 0.7,
39
- throttle: 400,
39
+ throttle: 100,
40
40
  callback: () => { console.log('Playback ended') },
41
41
  debug: true,
42
42
  });
43
43
 
44
- myButton.addEventListener('click', () => click.play());
44
+ const play = () => sound.play();
45
+
46
+ button.addEventListener('pointerdown', play);
45
47
  ```
46
48
  <br>
47
49
 
50
+ &#10148; **Options**
51
+
52
+ | Option | Type | Default | Description |
53
+ |:----------:|:-----------------------------------:|:--------:|:---------------------------------------------------------------------------------------------|
54
+ | `file` | `string` | `none` | The URL of the audio file to be played. |
55
+ | `volume` | `number` | `1.0` | Volume level for the audio playback, ranging from 0.0 (mute) to 1.0 (full volume). |
56
+ | `callback` | `((error?: Error) => void) \| null` | `null` | A callback function to be executed after the audio finishes playing, or if an error occurs. |
57
+ | `throttle` | `number` | `0` | Minimum time (in milliseconds) between successive audio plays to prevent rapid repeat plays. |
58
+ | `debug` | `boolean` | `false` | If `true`, debug information and errors will be logged to the console. |
59
+ <br>
60
+
48
61
  &#10148; **License**
49
62
 
50
63
  clicktone is released under MIT license.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clicktone",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "ClickTone is designed to control audio playback with various settings, including volume control, callback and debug mode. It also includes iOS support.",
5
5
  "author": "ux-ui.pro",
6
6
  "license": "MIT",