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.

17 lines (15 loc) 549 B
import { loadWithDefault, withOptionalLoading } from 'scrivito_sdk/loadable'; /** Evaluate the loadableFunction and return its result, if fully loaded. * Otherwise, return the default. * * You may use this without a loading context, but it will _not_ trigger loading! * If you want to be sure, that loading is triggered, prefer `loadWithDefault`. */ export function loadableWithDefault<T, S>( theDefault: T, loadableFunction: () => S, ): T | S { return withOptionalLoading(() => loadWithDefault(theDefault, loadableFunction), ); }