bigbuffet-rw/app/soapbox/precheck.ts

17 lines
671 B
TypeScript
Raw Normal View History

/**
* Precheck: information about the site before anything renders.
* @module soapbox/precheck
*/
2022-04-24 12:28:07 -07:00
/** Whether a page title was inserted with SSR. */
const hasTitle = Boolean(document.querySelector('title'));
2022-04-24 12:28:07 -07:00
/** Whether pre-rendered data exists in Mastodon's format. */
const hasPrerenderPleroma = Boolean(document.getElementById('initial-results'));
2022-04-24 12:28:07 -07:00
/** Whether pre-rendered data exists in Pleroma's format. */
const hasPrerenderMastodon = Boolean(document.getElementById('initial-state'));
2022-04-24 12:28:07 -07:00
/** Whether initial data was loaded into the page by server-side-rendering (SSR). */
export const isPrerendered = hasTitle || hasPrerenderPleroma || hasPrerenderMastodon;