rsnext/packages/next/client/dev/fouc.js

18 lines
505 B
JavaScript
Raw Normal View History

export function displayContent(callback) {
// This is the fallback helper that removes Next.js' no-FOUC styles when
// CSS mode is enabled. This only really activates if you haven't created
// _any_ styles in your application yet.
2020-05-18 21:24:37 +02:00
;(window.requestAnimationFrame || setTimeout)(function () {
for (
var x = document.querySelectorAll('[data-next-hide-fouc]'), i = x.length;
i--;
) {
x[i].parentNode.removeChild(x[i])
}
if (callback) {
callback()
}
})
}