UNPKG

react-apollo

Version:
46 lines 1.82 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import * as PropTypes from 'prop-types'; import { Component } from 'react'; var invariant = require('invariant'); var ApolloProvider = (function (_super) { __extends(ApolloProvider, _super); function ApolloProvider(props, context) { var _this = _super.call(this, props, context) || this; _this.operations = new Map(); invariant(props.client, 'ApolloClient was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.'); if (!props.client.__operations_cache__) { props.client.__operations_cache__ = _this.operations; } return _this; } ApolloProvider.prototype.getChildContext = function () { return { client: this.props.client, operations: this.props.client.__operations_cache__, }; }; ApolloProvider.prototype.render = function () { return this.props.children; }; ApolloProvider.propTypes = { client: PropTypes.object.isRequired, children: PropTypes.element.isRequired, }; ApolloProvider.childContextTypes = { client: PropTypes.object.isRequired, operations: PropTypes.object, }; return ApolloProvider; }(Component)); export default ApolloProvider; //# sourceMappingURL=ApolloProvider.js.map