constructor(backend){
this.backend = backend;
let ProviderClass = require(`./provider/${backend}.js`);
this.setProvider(backend);
this.provider = (async () => {
let provider = await new Promise(function(resolve, reject){
(new ProviderClass(acl)).then(function(provider){
return resolve(provider);
}).catch(function(err){
return reject(err);
});
});
return provider;
});
}
这是错误:
this.provider = (async () => {
^
SyntaxError: Unexpected token (
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
我尝试编写异步函数,但即使这样也会抛出一个错误,指出无论我赋予函数名称,它都将它视为标识符而不是函数。
帮助我!