Hi,
I'm wondering if Nuxt.js provides the ability to notify the client that Nuxt has setup properly.
The equivalent to to jQuery might be
$( document ).ready()
The use case is that I may have some code depending on window.$Nuxt, and a in-house mechanism for detect if it's ready would be great, for example, a simple event would do:
var e = new CustomEvent('nuxt-loaded')
window. dispatchEvent(e)
Hi. You can use window.onNuxtReady
helper.
if (process.browser) {
window.onNuxtReady((app) => {
console.log('Nuxt ready!')
})
}
@pi0 Thanks! It solves my problem.
Although using native API might be a better choice as there may be codes importing from
Most helpful comment
Hi. You can use
window.onNuxtReady
helper.