UNPKG

piral-core

Version:

The core library for creating a Piral instance.

58 lines (57 loc) 2.58 kB
import { ComponentType } from 'react'; import { RouteComponentProps } from 'react-router'; import { GlobalState, PageRegistration, ExtensionRegistration } from '../types'; /** * Returns a dispatcher that includes all mentioned dispatchers. * @param dispatchers The dispatchers to include. */ export declare function withAll(...dispatchers: Array<(state: GlobalState) => GlobalState>): (state: GlobalState) => GlobalState; /** * Returns a dispatcher that adds a page registration. * @param name The path of the page to register. * @param value The value of the page to register. * @returns The dispatcher. */ export declare function withPage(name: string, value: PageRegistration): (state: GlobalState) => GlobalState; /** * Returns a dispatcher that removes a page registration. * @param name The path of the page to unregister. * @returns The dispatcher. */ export declare function withoutPage(name: string): (state: GlobalState) => GlobalState; /** * Returns a dispatcher that adds an extension registration. * @param name The name of the extension to register. * @param value The value of the extension to register. * @returns The dispatcher. */ export declare function withExtension(name: string, value: ExtensionRegistration): (state: GlobalState) => GlobalState; /** * Returns a dispatcher that removes an extension registration. * @param name The name of the extension to unregister. * @param reference The reference for the extension. * @returns The dispatcher. */ export declare function withoutExtension(name: string, reference: any): (state: GlobalState) => GlobalState; /** * Returns a dispatcher that adds an extension registration from the root (no Pilet API). * @param name The name of the extension to register. * @param component The extension's component to use. * @returns The dispatcher. */ export declare function withRootExtension<T>(name: string, component: ComponentType<T>): (state: GlobalState) => GlobalState; /** * Returns a dispatcher that adds another provider. * @param provider The provider to include. * @returns The dispatcher. */ export declare function withProvider(provider: JSX.Element): (state: GlobalState) => GlobalState; /** * Returns a dispatcher that registers another route. * @param path The path of the route to register. * @param component The component representing the route. * @returns The dispatcher. */ export declare function withRoute<T extends { [K in keyof T]?: string; } = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): (state: GlobalState) => GlobalState;