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.

12 lines (8 loc) 366 B
import { ContextContainer, InternalError } from 'scrivito_sdk/common'; const constraint = new ContextContainer<boolean>(); export function failIfPerformanceConstraint(message: string): void { if (constraint.current()) throw new InternalError(message); } export function runWithPerformanceConstraint<T>(fn: () => T): T { return constraint.runWith(true, fn); }