UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

44 lines (41 loc) 6.04 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.connect = void 0; var _reactRedux = require("react-redux"); var _withLocalSelector = _interopRequireDefault(require("./with-local-selector")); // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project // eslint-disable-next-line @typescript-eslint/no-unused-vars var defaultMapStateToProps = function defaultMapStateToProps(state, _, __) { return state; }; // eslint-disable-next-line @typescript-eslint/no-unused-vars var defaultMapDispatchToProps = function defaultMapDispatchToProps() { return function (dispatch, _, __) { return { dispatch: dispatch }; }; }; var connect = exports.connect = function connect() { var mapStateToProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultMapStateToProps; var makeMapDispatchToProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultMapDispatchToProps; var reduxMergeProps = arguments.length > 2 ? arguments[2] : undefined; var options = arguments.length > 3 ? arguments[3] : undefined; return function (BaseComponent) { var mapDispatchToProps = makeMapDispatchToProps(); var reduxMapState = function reduxMapState(state, props) { return mapStateToProps(props.selector(state), props, state); }; var reduxMapDispatch = function reduxMapDispatch(dispatch, props) { return mapDispatchToProps(props.dispatch, props, dispatch); }; var ReduxComponent = (0, _reactRedux.connect)(reduxMapState, reduxMapDispatch, reduxMergeProps, options)(BaseComponent); // save selector to context so it can be accessed by its children return (0, _withLocalSelector["default"])(ReduxComponent); }; }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3RSZWR1eCIsInJlcXVpcmUiLCJfd2l0aExvY2FsU2VsZWN0b3IiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwiZGVmYXVsdE1hcFN0YXRlVG9Qcm9wcyIsInN0YXRlIiwiXyIsIl9fIiwiZGVmYXVsdE1hcERpc3BhdGNoVG9Qcm9wcy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