UNPKG

scrivito

Version:

Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.

23 lines (16 loc) 779 B
import { withDefaultSiteContext } from 'scrivito_sdk/app_support/current_page'; import { onReset } from 'scrivito_sdk/common'; import { BasicObj } from 'scrivito_sdk/models'; type HomepageCallback = () => BasicObj | null; let homepageCallback: HomepageCallback | undefined; export function setHomepageCallback(callback?: HomepageCallback): void { homepageCallback = callback; } export function homepageFromCallback(): BasicObj | null { if (!homepageCallback) return null; // Because the (real) callback accesses the realm, and the realm requires a // site id to return any obj, a (reasonable) site id is forced. // Otherwise this would result in a circular call. return withDefaultSiteContext(homepageCallback); } onReset(() => (homepageCallback = undefined));