-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpromises.html
More file actions
32 lines (29 loc) · 997 Bytes
/
promises.html
File metadata and controls
32 lines (29 loc) · 997 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
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser-polyfill.js"></script>
<script type="text/babel">
"use strict";
console.log("Je vais a mon entretien");
var myPromise = new Promise((resolve, reject)=> {
setTimeout(()=> {
let message = "Désoler, bonne chance pour la suite ! ";
//resolve("Bravo, vous êtes pris");
reject("Désoler, bonne chance pour la suite ! ");
}, 5000)
});
console.log("Je retourne à mes petites affaires");
myPromise.then((data) => {
console.log(data);
}, (err) => {
console.log(err);
});
console.log("Après pleins d'autres choses");
</script>
<title>ES6 via babel</title>
</head>
<body>
</body>
</html>