UNPKG

nuxt

Version:

Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.

16 lines (15 loc) 428 B
import { useNuxtApp } from "../nuxt.js"; import { requestIdleCallback } from "../compat/idle-callback.js"; export const onNuxtReady = (callback) => { if (import.meta.server) { return; } const nuxtApp = useNuxtApp(); if (nuxtApp.isHydrating) { nuxtApp.hooks.hookOnce("app:suspense:resolve", () => { requestIdleCallback(() => callback()); }); } else { requestIdleCallback(() => callback()); } };