UNPKG

@toloka-dev/tbx-external-field-client

Version:

Library designed to facilitate communication and configuration management between TBX and an external app

19 lines (17 loc) 884 B
type AsyncApi<T> = { [K in keyof T]: T[K] extends (...args: infer Args) => infer Return ? (...args: Args) => Promise<Return> : T[K]; }; type Theme = 'dark' | 'light'; interface ExternalFieldClientParentApi<Value = any, Config extends Record<string, unknown> = Record<string, unknown>> { getValue: () => Value | null; setValue: (value: Value | null | undefined) => void; getConfig: () => Config; setFullscreen?: (fullScreen: boolean) => Promise<void>; getFullscreen?: () => Promise<boolean>; } interface ExternalFieldClientChildApi<Value = any, Config extends Record<string, unknown> = Record<string, unknown>> { onChangeConfig: (changedConfig: Config) => void; onChangeValue: (changedValue: Value | null) => void; onChangeTheme: (theme: Theme) => void; } export type { AsyncApi, ExternalFieldClientChildApi, ExternalFieldClientParentApi, Theme };