Skip to content

Commit

Permalink
Apply review: Update definitions.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzo MENEGALDO committed Nov 7, 2024
1 parent 5265fbf commit 39ad20b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const isLanguageSupported = async (lang: string) => {
* [`openInstall()`](#openinstall)
* [`addListener('onRangeStart', ...)`](#addlisteneronrangestart)
* [Interfaces](#interfaces)
* [Enums](#enums)

</docgen-index>

Expand Down Expand Up @@ -202,7 +203,7 @@ addListener(eventName: 'onRangeStart', listenerFunc: (info: { start: number; end
| **`volume`** | <code>number</code> | The volume that the utterance will be spoken at. | <code>1.0</code> |
| **`voice`** | <code>number</code> | The index of the selected voice that will be used to speak the utterance. Possible voices can be queried using `getSupportedVoices`. | |
| **`category`** | <code>string</code> | Select the iOS Audio session category. Possible values: `ambient` and `playback`. Use `playback` to play audio even when the app is in the background. Only available for iOS. | <code>"ambient"</code> |
| **`queueStrategy`** | <code>number</code> | Select the strategy to adopt when several requests to speak overlap. Possible values: `0` and `1`. Use `0` to stop the current request when a new request is sent. Use `1` to buffer the speech request. The request will be executed when all previous requests have been completed. | <code>0</code> |
| **`queueStrategy`** | <code><a href="#queuestrategy">QueueStrategy</a></code> | Select the strategy to adopt when several requests to speak overlap. | <code>QueueStrategy.Flush</code> | 5.1.0 |


#### SpeechSynthesisVoice
Expand All @@ -224,6 +225,17 @@ The <a href="#speechsynthesisvoice">SpeechSynthesisVoice</a> interface represent
| ------------ | ----------------------------------------- |
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |


### Enums


#### QueueStrategy

| Members | Value | Description |
| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **`Add`** | <code>0</code> | Use `Add` to stop the current request when a new request is sent. |
| **`Flush`** | <code>1</code> | Use `Flush` to buffer the speech request. The request will be executed when all previous requests have been completed. |

</docgen-api>

## Changelog
Expand Down
19 changes: 14 additions & 5 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ export interface TextToSpeechPlugin {
): Promise<PluginListenerHandle>;
}

export enum QueueStrategy {
/**
* Use `Add` to stop the current request when a new request is sent.
*/
Add = 0,
/**
* Use `Flush` to buffer the speech request. The request will be executed when all previous requests have been completed.
*/
Flush = 1
}

export interface TTSOptions {
/**
* The text that will be synthesised when the utterance is spoken.
Expand Down Expand Up @@ -89,13 +100,11 @@ export interface TTSOptions {
category?: string;
/**
* Select the strategy to adopt when several requests to speak overlap.
* Possible values: `0` and `1`.
* Use `0` to stop the current request when a new request is sent.
* Use `1` to buffer the speech request. The request will be executed when all previous requests have been completed.
*
* @default 0
* @since 5.1.0
* @default QueueStrategy.Flush
*/
queueStrategy?: number;
queueStrategy?: QueueStrategy;
}

/**
Expand Down

0 comments on commit 39ad20b

Please sign in to comment.