-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathInitAbsent.js
More file actions
24 lines (19 loc) · 838 Bytes
/
InitAbsent.js
File metadata and controls
24 lines (19 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// console.log("******** enter the init block ********");
let resolved = false;
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms)).then(() => {resolved = true});
}
async function init() {
// console.log("******** enter initializeFunction hook ********");
// console.log("******** Is promised resolved? " + resolved + " ********");
// console.log("******** sleep for 20 ms... ********")
let p = await sleep(20);
// console.log("******** wake up ********");
// console.log("******** Is promised resolved? " + resolved + " ********");
}
init();
exports.handler = async (event, context) => {
// console.log("******** enter the handler ********");
// console.log("******** Is promised resolved? " + resolved + " ********");
return ( resolved ? true: false );
}