From aa5ed6fc701b461f23bd1bf14569bb5025e3b73d Mon Sep 17 00:00:00 2001
From: kangkai <kangk26@foxmail.com>
Date: Thu, 01 Apr 2021 17:48:17 +0800
Subject: [PATCH] 添加form和ajax上传文件的实例
---
Promise.html | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/Promise.html b/Promise.html
index e69de29..43a81cc 100644
--- a/Promise.html
+++ b/Promise.html
@@ -0,0 +1,41 @@
+<html>
+ <head>
+ <title>Promise</title>
+ <script type='text/javascript'>
+ var ok = true;
+ function successCallBack(){
+ console.log("成功");
+ };
+ function failureCallBack(){
+ console.log("失败");
+ };
+ function successCallBack1(){
+ console.log("成功1");
+ };
+ function failureCallBack1(){
+ console.log("失败1");
+ };
+
+ const wait = ()=> new Promise((resolve,reject)=> {
+ setTimeout(() => {
+ console.log('setTimeout1执行完毕');
+ resolve();
+ }, 0);
+ });
+
+ //调用报错,wait2返回的是setTimeout方法。
+ const wait1 = ()=> setTimeout(() => {
+ console.log('setTimeout2执行完毕');
+ return new Promise((resolve,reject)=> {
+ resolve();
+ });
+ }, 0);
+
+
+ var use = wait().then(successCallBack,failureCallBack).then(successCallBack1,failureCallBack1);
+ </script>
+ </head>
+ <body>
+
+ </body>
+</html>
\ No newline at end of file
--
Gitblit v1.9.3