forked from jovotech/jovo-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappProgressiveResponse.js
58 lines (43 loc) · 1.36 KB
/
appProgressiveResponse.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict';
// =================================================================================
// App Configuration
// =================================================================================
const {App} = require('jovo-framework');
const config = {
logging: true,
};
const app = new App(config);
// =================================================================================
// App Logic
// =================================================================================
app.setHandler({
'LAUNCH': function() {
// async amazon api call
// this.alexaSkill().progressiveResponse('Test', () => {
// console.log('lalal');
// });
// or more than one progressive responses
this.alexaSkill().progressiveResponse('Processing your request', () => {
setTimeout( () => {
this.alexaSkill().progressiveResponse('Still processing');
}, 1500);
});
dummyApiCall( () => {
this.tell('Here is your information.');
});
},
'HelloWorldIntent': function() {
this.tell('Hello World!');
},
'Unhandled': function() {
this.tell('Unhandled');
},
});
module.exports.app = app;
/**
* Simulates a long api call
* @param {func} callback
*/
function dummyApiCall(callback) {
setTimeout(callback, 7000);
}