mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
Fix issue #829 with onNuxtReady undefined
This commit is contained in:
parent
43de27faef
commit
ea03d76e85
@ -12,9 +12,19 @@ import App from '<%= appPath %>'
|
|||||||
|
|
||||||
import { getContext } from './utils'
|
import { getContext } from './utils'
|
||||||
|
|
||||||
|
if (process.browser) {
|
||||||
|
// window.onNuxtReady(() => console.log('Ready')) hook
|
||||||
|
// Useful for jsdom testing or plugins (https://github.com/tmpvar/jsdom#dealing-with-asynchronous-script-loading)
|
||||||
|
window._nuxtReadyCbs = []
|
||||||
|
window.onNuxtReady = function (cb) {
|
||||||
|
window._nuxtReadyCbs.push(cb)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Import SSR plugins
|
// Import SSR plugins
|
||||||
<% plugins.forEach(function (plugin) { if (plugin.ssr)
|
<% plugins.forEach(function (plugin) { if (plugin.ssr)
|
||||||
{ %>import <%= plugin.name %> from '<%= r(plugin.src) %>'
|
{ %>let <%= plugin.name %> = require('<%= r(plugin.src) %>')
|
||||||
|
<%= plugin.name %> = <%= plugin.name %>.default || <%= plugin.name %>
|
||||||
<% }}) %>
|
<% }}) %>
|
||||||
|
|
||||||
// Component: <nuxt-child>
|
// Component: <nuxt-child>
|
||||||
@ -58,12 +68,6 @@ async function createApp (ssrContext) {
|
|||||||
store.replaceState(window.__NUXT__.state)
|
store.replaceState(window.__NUXT__.state)
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
// window.onNuxtReady(() => console.log('Ready')) hook
|
|
||||||
// Useful for jsdom testing or plugins (https://github.com/tmpvar/jsdom#dealing-with-asynchronous-script-loading)
|
|
||||||
window._nuxtReadyCbs = []
|
|
||||||
window.onNuxtReady = function (cb) {
|
|
||||||
window._nuxtReadyCbs.push(cb)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// root instance
|
// root instance
|
||||||
|
Loading…
Reference in New Issue
Block a user