kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
116 lines (115 loc) • 3.57 kB
TypeScript
/// <reference types="lodash" />
export declare const FORWARD = "@redux-forward/FORWARD";
export declare const ADDRESS_PREFIX = "@@KG_";
export declare const getActionForwardAddress: (id: any) => string;
/**
* Wrap an action into a forward action that only modify the state of a specific
* kepler.gl instance. kepler.gl reducer will look for signatures in the action to
* determine whether it needs to be forwarded to a specific instance reducer.
*
* wrapTo can be curried. You can create a curried action wrapper by only supply the `id` argument
*
* A forward action looks like this
* ```js
* {
* type: "@@kepler.gl/LAYER_CONFIG_CHANGE",
* payload: {
* type: '@@kepler.gl/LAYER_CONFIG_CHANGE',
* payload: {},
* meta: {
* // id of instance
* _id_: id
* // other meta
* }
* },
* meta: {
* _forward_: '@redux-forward/FORWARD',
* _addr_: '@@KG_id'
* }
* };
* ```
*
* @memberof forwardActions
* @param {string} id - The id to forward to
* @param {Object} action - the action object {type: string, payload: *}
* @returns {{type: string, payload: {type: string, payload: *, meta: {_id_: string}, meta: {_forward_: string, _addr_: string}}}}
* @public
* @example
*
* import {wrapTo, togglePerspective} from 'kepler.gl/actions';
*
* // This action will only dispatch to the KeplerGl instance with `id: map_1`
* this.props.dispatch(wrapTo('map_1', togglePerspective()));
*
* // You can also create a curried action for each instance
* const wrapToMap1 = wrapTo('map_1');
* this.props.dispatch(wrapToMap1(togglePerspective()));
*/
export declare const wrapTo: import("lodash").CurriedFunction2<any, any, {
type: any;
payload: any;
meta: any;
}>;
/**
* Whether an action is a forward action
* @memberof forwardActions
* @param {Object} action - the action object
* @returns {boolean} boolean - whether the action is a forward action
* @public
*/
export declare const isForwardAction: (action: any) => boolean;
/**
* Unwrap an action
* @memberof forwardActions
* @param {Object} action - the action object
* @returns {Object} - unwrapped action
* @public
*/
export declare const unwrap: (action: any) => any;
/**
* Given an id, returns the action for that id.
* If the action is not a forward action, return the action
* @memberof forwardActions
* @param {String} id
* @param {Object} action
* @private
*/
export declare const _actionFor: (id: any, action: any) => any;
/**
* Returns an action dispatcher that wraps and forwards the actions to a specific instance
* @memberof forwardActions
* @param {string} id - instance id
* @param {Function} dispatch - action dispatcher
* @public
* @example
*
* // action and forward dispatcher
* import {toggleSplitMap, forwardTo} from 'kepler.gl/actions';
* import {connect} from 'react-redux';
*
* const MapContainer = props => (
* <div>
* <button onClick={() => props.keplerGlDispatch(toggleSplitMap())}/>
* </div>
* )
*
* const mapDispatchToProps = (dispatch, props) => ({
* dispatch,
* keplerGlDispatch: forwardTo(‘foo’, dispatch)
* });
*
* export default connect(
* state => state,
* mapDispatchToProps
* )(MapContainer);
*/
export declare const forwardTo: (id: any, dispatch: any) => (action: any) => any;
/**
* Update the state of a kepler.gl instance
* @memberof forwardActions
* @param {Object} state
* @param {string} id
* @param {Object} nextState
* @private
*/
export declare const _updateProperty: (state: any, id: any, nextState: any) => any;