embed-fbcmt-client
Version:
client package for embed-fbcmt
42 lines (39 loc) • 1.56 kB
TypeScript
declare enum SUCCESS_CODES {
SUCCESS_DONE = "success.done"
}
declare enum ERROR_CODES {
ERROR_LOAD_SDK_FAILED = "error.load_sdk_failed",
ERROR_PARAMS_HREF_NOT_EXISTS = "error.params_href_not_exists",
ERROR_TIMEOUT = "error.timeout"
}
declare enum LOADING_CODES {
LOADING_LOADING_SDK = "loading.loading_sdk",
LOADING_LOADING_PLUGIN = "loading.loading_plugin"
}
declare enum PENDING {
PENDING = "pending"
}
type CODES = SUCCESS_CODES | ERROR_CODES | LOADING_CODES;
interface Props {
color_scheme: "light" | "dark";
href: string;
lazy: boolean | undefined;
mobile: boolean | undefined;
num_posts: number;
order_by: "time" | "reverse_time";
lang: string;
origin: string;
no_socket: boolean;
active: boolean;
no_popup: boolean;
}
declare function setPropValue(el: HTMLIFrameElement, props: Partial<Props>, origin?: string): Promise<void>;
declare function setPropValue<T extends keyof Props>(el: HTMLIFrameElement, prop: T, value: Props[T], origin?: string): Promise<void>;
declare function listenEvent(el: HTMLIFrameElement, cb: (event: {
type: "success" | "loading" | "error";
code: CODES;
message: string;
}) => void): () => void;
declare function listenResize(el: HTMLIFrameElement, type: "width" | "height", cb: (size: number) => void): () => void;
declare function getTypeCode(code: any): "success" | "loading" | "error" | null;
export { CODES as C, ERROR_CODES as E, PENDING as P, Props as a, listenEvent as b, getTypeCode as g, listenResize as l, setPropValue as s };