UNPKG

@modern-js/runtime-utils

Version:

A Progressive React Framework for modern web development.

16 lines (15 loc) 466 B
import "node:module"; class LoaderContext { getDefaultValue() { if (!this.defaultValue) throw new Error("Can't get defaultValue before initialed"); return this.defaultValue; } constructor(defaultValue){ this.defaultValue = defaultValue; this.symbol = Symbol('loaderContext'); } } function createLoaderContext(defaultValue) { return new LoaderContext(defaultValue); } export { LoaderContext, createLoaderContext };