Skip to content

Commit 4d0c347

Browse files
chore(deps): Update examples and dependencies (#139)
chore(deps): Update examples and dependencies
2 parents 80a4e7f + 9d5bbdb commit 4d0c347

File tree

9 files changed

+7160
-3519
lines changed

9 files changed

+7160
-3519
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test/resources/tts-auth.json
88
doc/
99
*-auth.json
1010
.env
11+
examples/static/bower_components/
1112
examples/static/webpack-bundle.js
1213
examples/static/scripts/
1314
examples/node_modules/

examples/package-lock.json

Lines changed: 2182 additions & 1152 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"dependencies": {
1414
"defaults": "^1.0.3",
1515
"dotenv": "^6.2.0",
16-
"express": "^4.13.3",
16+
"express": "^4.17.1",
1717
"express-browserify": "^1.0.3",
1818
"express-rate-limit": "^2.6.0",
1919
"express-secure-only": "^0.2.1",
2020
"jquery": "^3.4.1",
2121
"object.assign": "^4.0.4",
22-
"vcap_services": "^0.4.0",
23-
"watson-developer-cloud": "3.18.1",
22+
"vcap_services": "^0.7.0",
23+
"watson-developer-cloud": "^4.0.1",
2424
"watson-speech": "*",
2525
"webpack": "^3.5.5",
2626
"webpack-dev-middleware": "^1.10.0",

examples/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ app.use('/api/speech-to-text/token', function(req, res) {
102102
res.status(500).send('Error retrieving token');
103103
return;
104104
}
105-
res.send(token);
105+
res.send(token.token || token);
106106
});
107107
});
108108

@@ -125,7 +125,7 @@ app.use('/api/text-to-speech/token', function(req, res) {
125125
res.status(500).send('Error retrieving token');
126126
return;
127127
}
128-
res.send(token);
128+
res.send(token.token || token);
129129
});
130130
});
131131

examples/static/text-to-speech-custom-voice.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ <h2>Code for this demo:</h2>
5252
// synthesize and play the text using the chosen voice
5353
document.querySelector('#button').onclick = function() {
5454
getTtsToken().then(function(token) {
55-
WatsonSpeech.TextToSpeech.synthesize({
55+
const audio = WatsonSpeech.TextToSpeech.synthesize({
5656
text: document.querySelector('#text').value,
5757
voice: document.querySelector('#voice').value,
5858
token: token // use `access_token` as the parameter name if using an RC service
59-
}).on('error', function(err) {
60-
console.log('audio error: ', err);
6159
});
60+
audio.onerror = function(err) {
61+
console.log('audio error: ', err);
62+
};
6263
});
6364
};
6465
</script></code></pre>

examples/static/text-to-speech-preload.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ <h2>Code for this demo:</h2>
3535
accept: 'audio/wav'
3636
});
3737

38-
audio.on('error', function(err) {
38+
audio.onerror = function(err) {
3939
console.log('audio error: ', err);
40-
});
40+
};
4141
});
4242

4343
document.querySelector('#button').onclick = function() {

examples/static/text-to-speech.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ <h2>Code for this demo:</h2>
2828
return response.text();
2929
})
3030
.then(function(token) {
31-
WatsonSpeech.TextToSpeech.synthesize({
31+
const audio = WatsonSpeech.TextToSpeech.synthesize({
3232
text: document.querySelector('#text').value,
3333
token: token // use `access_token` as the parameter name if using an RC service
34-
}).on('error', function(err) {
35-
console.log('audio error: ', err);
3634
});
35+
audio.onerror = function(err) {
36+
console.log('audio error: ', err);
37+
};
3738
});
3839
};
3940
</script></code></pre>

0 commit comments

Comments
 (0)