mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
[modules] Support promise
This commit is contained in:
parent
336ebd4959
commit
b701424aae
@ -99,12 +99,15 @@ class Module {
|
|||||||
}
|
}
|
||||||
// Call module with `this` context and pass options
|
// Call module with `this` context and pass options
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
return module.call(this, options, err => {
|
const result = module.call(this, options, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err)
|
return reject(err)
|
||||||
}
|
}
|
||||||
resolve(module)
|
resolve(module)
|
||||||
})
|
})
|
||||||
|
if (result && result.then instanceof Function) {
|
||||||
|
return result.then(resolve)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user