Skip to content

Commit f9ad776

Browse files
committed
update readme
1 parent bc5a4f5 commit f9ad776

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
![Build CI](https://github.com/bradmartin/nativescript-texttospeech/workflows/Build%20CI/badge.svg)
12
[![npm](https://img.shields.io/npm/v/nativescript-texttospeech.svg)](https://www.npmjs.com/package/nativescript-texttospeech)
23
[![npm](https://img.shields.io/npm/dt/nativescript-texttospeech.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-texttospeech)
3-
[![Build Status](https://travis-ci.org/bradmartin/nativescript-texttospeech.svg?branch=master)](https://travis-ci.org/bradmartin/nativescript-texttospeech)
44

55
# NativeScript-TextToSpeech :loudspeaker:
66

@@ -15,8 +15,16 @@ A Text to Speech NativeScript plugin for Android & iOS
1515

1616
Run the following command from the root of your project:
1717

18+
NativeScript version 7+:
19+
20+
```
21+
tns plugin add nativescript-texttospeech
22+
```
23+
24+
NativeScript Version below 7:
25+
1826
```
19-
$ tns plugin add nativescript-texttospeech
27+
tns plugin add nativescript-texttospeech@2.0.3
2028
```
2129

2230
This command automatically installs the necessary files, as well as stores nativescript-texttospeech as a dependency in your project's package.json file.
@@ -29,28 +37,28 @@ This command automatically installs the necessary files, as well as stores nativ
2937

3038
```js
3139
/// javascript
32-
var TextToSpeech = require('nativescript-texttospeech');
40+
const TextToSpeech = require('nativescript-texttospeech');
3341

3442
/// TypeScript
3543
import { TNSTextToSpeech, SpeakOptions } from 'nativescript-texttospeech';
3644

37-
let TTS = new TNSTextToSpeech();
45+
const TTS = new TNSTextToSpeech();
3846

39-
let speakOptions: SpeakOptions = {
47+
const speakOptions: SpeakOptions = {
4048
text: 'Whatever you like', /// *** required ***
4149
speakRate: 0.5, // optional - default is 1.0
4250
pitch: 1.0, // optional - default is 1.0
4351
volume: 1.0, // optional - default is 1.0
4452
locale: 'en-GB', // optional - default is system locale,
45-
finishedCallback: Function // optional
53+
finishedCallback: Function, // optional
4654
};
4755

4856
// Call the `speak` method passing the SpeakOptions object
4957
TTS.speak(speakOptions).then(
5058
() => {
5159
// everything is fine
5260
},
53-
err => {
61+
(err) => {
5462
// oops, something went wrong!
5563
}
5664
);
@@ -80,18 +88,18 @@ The plugin checks whether the supplied locale/language code has the correct synt
8088
Example with language code only:
8189

8290
```js
83-
let speakOptions: SpeakOptions = {
91+
const speakOptions: SpeakOptions = {
8492
text: 'Whatever you like', // *** required ***
85-
language: 'en' // english language will be used
93+
language: 'en', // english language will be used
8694
};
8795
```
8896

8997
Example with locale:
9098

9199
```js
92-
let speakOptions: SpeakOptions = {
100+
const speakOptions: SpeakOptions = {
93101
text: 'Whatever you like', // *** required ***
94-
locale: 'en-AU' // australian english language will be used
102+
locale: 'en-AU', // australian english language will be used
95103
};
96104
```
97105

0 commit comments

Comments
 (0)