📌  相关文章
📜  如何从节点 js 中的字符串创建异步函数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:22.929000             🧑  作者: Mango

代码示例1
// Shim for allowing async function creation via new Function
const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;

// Usage
const fetchPage = new AsyncFunction("url", "return await fetch(url);");
fetchPage("/").then(response => { ... });