Apoorva
#1
Hi
Trying to use “await” in cocos creator but it keeps throwing “ReferenceError: regeneratorRuntime is not defined”
I tried installing babel-polyfill modules and then importing it as well, but it didn’t work.
Please let me know the right way of using async functions.
@Big_Bear can probably tell us.
require async.js in you project,
Like this.
var async = require("async");
cc.Class({
extends: cc.Component,
properties: {
},
start() {
var arr = [0, 1, 2, 3, 4];
async.eachLimit(arr, 5, () => {
console.log('Cocos Creator');
});
},
});
2 Likes
I used Promises when doing async/await.
reference: