mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
refactor: simplify return value in addModule (#4766)
This commit is contained in:
parent
381e0af52f
commit
9c9d519576
@ -111,7 +111,7 @@ export default class ModuleContainer {
|
|||||||
return this.addModule(moduleOpts, true /* require once */)
|
return this.addModule(moduleOpts, true /* require once */)
|
||||||
}
|
}
|
||||||
|
|
||||||
addModule(moduleOpts, requireOnce) {
|
async addModule(moduleOpts, requireOnce) {
|
||||||
let src
|
let src
|
||||||
let options
|
let options
|
||||||
let handler
|
let handler
|
||||||
@ -157,17 +157,7 @@ export default class ModuleContainer {
|
|||||||
options = {}
|
options = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
const result = await handler.call(this, options)
|
||||||
// Call module with `this` context and pass options
|
return result
|
||||||
const result = handler.call(this, options)
|
|
||||||
|
|
||||||
// If module send back a promise
|
|
||||||
if (result && result.then) {
|
|
||||||
return resolve(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// synchronous
|
|
||||||
return resolve()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user