UNPKG

@shopify/app-bridge

Version:

[![Build Status](https://travis-ci.com/Shopify/app-bridge.svg?token=RBRyvqQyN525bnfz7J8p&branch=master)](https://travis-ci.com/Shopify/app-bridge) [![codecov](https://codecov.io/gh/Shopify/app-bridge/branch/master/graph/badge.svg?token=nZ21m39Dr6)](https:

36 lines (35 loc) 1.44 kB
/** * @module Flash */ import { ClientApplication } from '../../client'; import { ActionSet } from '../helper'; import { ActionSetProps, Group, MetaAction } from '../types'; import { ErrorAction } from '../Error'; import { Action, ActionType, ClearPayload, Options, Payload } from './types'; export interface ActionBase extends MetaAction { readonly group: typeof Group.Flash; } export interface ShowAction extends ActionBase { readonly type: typeof ActionType.SHOW; readonly payload: Payload; } export interface ClearAction extends ActionBase { readonly type: typeof ActionType.CLEAR; } export declare type FlashAction = ShowAction | ClearAction | MetaAction; export declare function show(flashMessage: Payload): ShowAction; export declare function clear(payload: ClearPayload): ClearAction; export declare function validationError(action: ShowAction | ClearAction | MetaAction): undefined | ErrorAction; export declare class Flash extends ActionSet implements ActionSetProps<Options, Payload> { message: string; isDismissible?: boolean; duration: number; isError?: boolean; constructor(app: ClientApplication<any>, options: Options); readonly options: Options; readonly payload: Payload; set(options: Partial<Options>): this; dispatch(action: Action): this; private validateOptions(options); } export declare function create(app: ClientApplication<any>, options: Options): Flash;