mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
perf: prevent duplicate showReady
This commit is contained in:
parent
a5373f2464
commit
89d5f3753e
@ -129,7 +129,7 @@ function startDev(oldInstance) {
|
|||||||
// Pass new nuxt to watch chain
|
// Pass new nuxt to watch chain
|
||||||
.then(() => instance)
|
.then(() => instance)
|
||||||
// Call showReady
|
// Call showReady
|
||||||
.then(() => nuxt.showReady(true))
|
.then(() => nuxt.showReady())
|
||||||
// Handle errors
|
// Handle errors
|
||||||
.catch(err => onError(err, instance))
|
.catch(err => onError(err, instance))
|
||||||
)
|
)
|
||||||
|
@ -81,5 +81,5 @@ if (nuxt.options.render.ssr === true) {
|
|||||||
const { port, host } = getLatestHost(argv)
|
const { port, host } = getLatestHost(argv)
|
||||||
|
|
||||||
nuxt.listen(port, host).then(() => {
|
nuxt.listen(port, host).then(() => {
|
||||||
nuxt.showReady()
|
nuxt.showReady(false)
|
||||||
})
|
})
|
||||||
|
@ -209,7 +209,7 @@ export default class WebpackBaseConfig {
|
|||||||
compiledIn: false,
|
compiledIn: false,
|
||||||
done: () => {
|
done: () => {
|
||||||
if (this.options.dev) {
|
if (this.options.dev) {
|
||||||
this.nuxt.showReady(true)
|
this.nuxt.showReady()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
@ -21,7 +21,7 @@ export default class Nuxt {
|
|||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
this.options = Options.from(options)
|
this.options = Options.from(options)
|
||||||
|
|
||||||
this.readyMessage = 'Ready'
|
this.readyMessage = null
|
||||||
this.initialized = false
|
this.initialized = false
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
@ -106,7 +106,11 @@ export default class Nuxt {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
showReady(clear = false) {
|
showReady(clear = true) {
|
||||||
|
if (!this.readyMessage) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
logger.ready({
|
logger.ready({
|
||||||
message: this.readyMessage,
|
message: this.readyMessage,
|
||||||
badge: true,
|
badge: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user