mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-18 15:02:09 +00:00
34 lines
823 B
HTML
34 lines
823 B
HTML
<!DOCTYPE html>
|
|
|
|
<html lang="zh-cn">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>PromiseTest</title>
|
|
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
|
</head>
|
|
|
|
<body>
|
|
<script>
|
|
var promise1 = new Promise(resolve => {
|
|
setTimeout(() => {
|
|
console.log('2s.');
|
|
resolve('promise1');
|
|
}, 2000);
|
|
});
|
|
|
|
promise1.then(data => {
|
|
console.log(`${data}, 3s`);
|
|
return new Promise(resolve => {
|
|
setTimeout(() => {
|
|
console.log('promise2');
|
|
resolve('promise2');
|
|
}, 3000);
|
|
});
|
|
}).then(data => {
|
|
console.log(`${data},promise3`);
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |