增加判断浏览器是否支持Async和Await的方法

This commit is contained in:
吴长征 2020-06-06 21:00:08 +08:00
parent 17d50089a3
commit 82354af6a9

10
js/asyncSupport Normal file
View File

@ -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;
}