• Beta

    Returns the config JSON loaded from the configUrl, for apps built with any editor.

    This is the low-level counterpart of parseConfig and parseEnrichedConfig: it works for every editor, but does not standardize, enrich or validate the config.

    ⚠️ If your app is built with the standard Showpad experience app editor, use parseConfig or parseEnrichedConfig instead to get a standardized and typed config.

    ⚠️ No runtime validation or migration is performed. T is only a type hint, so callers are responsible for validating the returned value and for migrating configs saved with an older version of their editor (e.g. when a newer version adds a required field).

    ⚠️ There is no fallback to ./config.json. When no configUrl is set, undefined is returned.

    The result is memoized — repeated calls return the same promise instance.

    Example

    import { Showpad } from '@showpad/experience-app-sdk'

    interface MyConfig {
    title: string
    }

    // Default config bundled with the app, used when no `configUrl` is set
    const defaultConfig: MyConfig = {
    title: 'My experience app',
    }

    const config = (await Showpad.getConfig<MyConfig>()) ?? defaultConfig

    Type Parameters

    • T = unknown

      Expected shape of the config. Defaults to unknown.

    Returns Promise<T>

    The config cast to T, or undefined when no configUrl is set.

Generated using TypeDoc