@gaoding/open-sdk
Version:
- 稿定设计开放平台对接SDK。
32 lines (31 loc) • 1.1 kB
TypeScript
import { IframeProps, IframeModalProps } from '../core/iframe';
export interface SDKConfig {
debug?: boolean;
container?: string | HTMLElement;
iframeProps?: Exclude<IframeProps, 'container'>;
modalProps?: Exclude<IframeModalProps, 'onClose'>;
onCloseModal?: (...args: any[]) => Promise<void | boolean> | void | boolean;
}
export interface BasePageOptions {
origin?: string;
path: string;
query?: Record<string, any>;
configCode?: string;
tokenData?: string;
}
export interface PageOptions extends BasePageOptions {
eventMap?: Record<string, any> | null;
onMessage?: (payload: {
type: string;
data: any;
}) => void;
}
export declare const createSDKCore: (config: SDKConfig) => {
open: (options: PageOptions) => void;
close: (triggerOnCloseModal?: boolean, ...args: any[]) => any;
setVisible: any;
emit: (type: string, payload?: any) => Promise<any>;
on: (name: any, handler: Function) => () => void;
once: (name: string, handler: Function) => () => void;
off: (name: string, handler: Function) => void;
};