这个可以
sleep(n_seconds){ return new Promise(resolve => setTimeout(resolve, n_seconds * 1000)) }, async init() { await sleep(3) }
这个也行: (注意 setTimeout中的resolve的写法。。。)
return new Promise( (resolve, reject) => { setTimeout( () => { resolve() }, n_seconds * 1000) })