Skip to content

Commit bf13f84

Browse files
committed
feat: rename initialize to configure across API
1 parent d4a19b5 commit bf13f84

7 files changed

Lines changed: 12 additions & 12 deletions

File tree

android/src/main/java/com/speech/RNSpeechModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ class RNSpeechModule(reactContext: ReactApplicationContext) :
458458
}
459459
}
460460

461-
override fun initialize(options: ReadableMap) {
461+
override fun configure(options: ReadableMap) {
462462
val newOptions = globalOptions.toMutableMap()
463463
newOptions.putAll(getValidatedOptions(options))
464464
globalOptions = newOptions

docs/USAGE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ Speech.openVoiceDataInstaller().catch(error => {
205205

206206
---
207207

208-
### Initializing Global Speech Options
208+
### Configuring Global Speech Options
209209

210210
Set global speech options that apply to all speech synthesis calls.
211211

212212
**API Definition:**
213213

214214
```ts
215-
Speech.initialize(options: VoiceOptions): void
215+
Speech.configure(options: VoiceOptions): void
216216
```
217217

218218
**VoiceOptions Properties:**
@@ -236,7 +236,7 @@ Speech.initialize(options: VoiceOptions): void
236236
**Example Usage:**
237237

238238
```ts
239-
Speech.initialize({
239+
Speech.configure({
240240
language: 'en-US',
241241
volume: 1.0,
242242
pitch: 1.2,

example/src/views/RootView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const RootView: React.FC = () => {
3737
const targetId = React.useRef<string>('');
3838

3939
React.useEffect(() => {
40-
// Speech.initialize({silentMode: 'obey', ducking: true});
40+
// Speech.configure({silentMode: 'obey', ducking: true});
4141

4242
const onSpeechEnd = () => {
4343
setIsStarted(false);
@@ -92,7 +92,7 @@ const RootView: React.FC = () => {
9292

9393
// (async () => {
9494
// const enVoices = await Speech.getAvailableVoices('en-us');
95-
// Speech.initialize({
95+
// Speech.configure({
9696
// rate: 0.5,
9797
// volume: 1,
9898
// voice: enVoices[3]?.identifier,

ios/RNSpeech.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ - (AVSpeechUtterance *)getUtterance:(NSString *)text withOptions:(NSDictionary *
217217
return utterance;
218218
}
219219

220-
- (void)initialize:(VoiceOptions &)options {
220+
- (void)configure:(VoiceOptions &)options {
221221
NSMutableDictionary *newOptions = [NSMutableDictionary dictionaryWithDictionary:self.globalOptions];
222222
NSDictionary *validatedOptions = [self getValidatedOptions:options];
223223
[newOptions addEntriesFromDictionary:validatedOptions];

jest/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Speech {
1414
static maxInputLength = 4000;
1515
static reset = mockFn;
1616
static stop = mockPromise;
17-
static initialize = mockFn;
17+
static configure = mockFn;
1818
static speak = mockPromise;
1919
static pause = mockPromiseBool;
2020
static resume = mockPromiseBool;

src/NativeSpeech.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export interface Spec extends TurboModule {
9999
isSpeaking: () => Promise<boolean>;
100100
speak: (text: string) => Promise<string>;
101101
getEngines: () => Promise<EngineProps[]>;
102-
initialize: (options: VoiceOptions) => void;
102+
configure: (options: VoiceOptions) => void;
103103
openVoiceDataInstaller: () => Promise<void>;
104104
setEngine: (engineName: string) => Promise<void>;
105105
getAvailableVoices: (language?: string) => Promise<VoiceProps[]>;

src/Speech.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ export default class Speech {
7373
* Sets the global options for all subsequent speak() calls
7474
* @param options - Voice configuration options
7575
* @example
76-
* Speech.initialize({
76+
* Speech.configure({
7777
* pitch: 1.2,
7878
* rate: 0.8,
7979
* volume: 1.0,
8080
* language: 'en-US'
8181
* });
8282
*/
83-
public static initialize(options: VoiceOptions): void {
84-
TurboSpeech.initialize(options);
83+
public static configure(options: VoiceOptions): void {
84+
TurboSpeech.configure(options);
8585
}
8686
/**
8787
* Resets all speech options to their default values

0 commit comments

Comments
 (0)