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:

40 lines (39 loc) 1.18 kB
/** * @module client * */ import { ActionCallback, AnyAction, Dispatch, ErrorSubscriber, Unsubscribe } from '../actions/types'; /** * @todo Move `MessageTransport` into shared space. */ import { Handler, MessageTransport } from '../host'; export interface AppConfig { apiKey: string; shopOrigin?: string; forceRedirect?: boolean; } export interface ClientApplication<S> { dispatch: Dispatch<AnyAction>; localOrigin: string; error: ErrorSubscriber; getState(query?: string): Promise<S>; subscribe(callback: ActionCallback, id?: string): Unsubscribe; subscribe(eventNameSpace: string, callback: ActionCallback, id?: string): Unsubscribe; } export interface ClientApplicationCreator { <S>(config: AppConfig, initialState?: S): ClientApplication<S>; } /** * @todo Generalize—pramaterize return type */ export interface ClientApplicationTransportInjector { (transport: MessageTransport): ClientApplicationCreator; } export interface ActionListenersMap { [index: string]: ActionListener[]; } export interface ActionListener { id?: string; callback(data: any): void; } export { AnyAction, Dispatch, Handler, Unsubscribe };