From 82354af6a9a080c72688c668abeb9748b4faf3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E9=95=BF=E5=BE=81?= Date: Sat, 6 Jun 2020 21:00:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E6=98=AF=E5=90=A6=E6=94=AF=E6=8C=81Async?= =?UTF-8?q?=E5=92=8CAwait=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/asyncSupport | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 js/asyncSupport diff --git a/js/asyncSupport b/js/asyncSupport new file mode 100644 index 0000000..a5490a6 --- /dev/null +++ b/js/asyncSupport @@ -0,0 +1,10 @@ +//判断浏览器是否支持Async和Await +function isAsyncAwaitSupport() { + let func; + try { + eval("func = async function(){};"); + } catch (e) { + return false; + } + return Object.getPrototypeOf(func).constructor != null; +} \ No newline at end of file