UNPKG

@line/liff-mock

Version:

Make testing your LIFF app easy

23 lines (22 loc) 791 B
import liff from '@line/liff'; import { Config } from '@liff/types'; import { MockData } from './store/MockDataStore'; export declare type ActualLiff = typeof liff; export declare type LiffMockConfig = { mock?: boolean; }; export declare type ExtendedConfig = Config & LiffMockConfig; export declare type ExtendedInit = (config: ExtendedConfig, successCallback?: () => void, errorCallback?: (error: Error) => void) => Promise<void>; export declare type LiffMockApi = { set: (data: Partial<MockData> | ((prev: Partial<MockData>) => Partial<MockData>)) => void; clear: () => void; }; export declare type LiffMock = { init: ExtendedInit; $mock: LiffMockApi; } & Omit<ActualLiff, 'init'>; declare global { interface Window { liff: ActualLiff | undefined; } }