mirror of
https://github.com/multipleof4/ntfy.git
synced 2026-10-08 21:05:21 +00:00
Root ref
This commit is contained in:
@@ -2,12 +2,13 @@
|
|||||||
// navigate client-side (fading back in) or full-reload (the splash fades the next page in).
|
// navigate client-side (fading back in) or full-reload (the splash fades the next page in).
|
||||||
|
|
||||||
const FADE_MS = 150;
|
const FADE_MS = 150;
|
||||||
|
const rootNode = () => document.getElementById("root");
|
||||||
|
|
||||||
// Fade #root out, resolving when done. Exported so callers can await it before their own
|
// Fade #root out, resolving when done. Exported so callers can await it before their own
|
||||||
// teardown + reload (e.g. resetAndRedirect wiping IndexedDB).
|
// teardown + reload (e.g. resetAndRedirect wiping IndexedDB).
|
||||||
export const fadeOut = () =>
|
export const fadeOut = () =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
const node = document.getElementById("root");
|
const node = rootNode();
|
||||||
if (!node) {
|
if (!node) {
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
@@ -20,7 +21,7 @@ export const fadeOut = () =>
|
|||||||
// Fade #root back in, then strip the inline styles (a lingering `transition` would animate future
|
// Fade #root back in, then strip the inline styles (a lingering `transition` would animate future
|
||||||
// opacity changes). setTimeout, not rAF, so a backgrounded tab can't strand #root at opacity 0.
|
// opacity changes). setTimeout, not rAF, so a backgrounded tab can't strand #root at opacity 0.
|
||||||
const fadeInRoot = () => {
|
const fadeInRoot = () => {
|
||||||
const node = document.getElementById("root");
|
const node = rootNode();
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user