"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var react_1 = require('react');
var Provider = (function (_super) {
__extends(Provider, _super);
function Provider(props, context) {
_super.call(this, props, context);
this.client = props.client;
if (props.store) {
this.store = props.store;
return;
}
props.client.initStore();
this.store = props.client.store;
}
Provider.prototype.getChildContext = function () {
return {
store: this.store,
client: this.client,
};
};
Provider.prototype.render = function () {
var children = this.props.children;
return react_1.Children.only(children);
};
Provider.propTypes = {
store: react_1.PropTypes.shape({
subscribe: react_1.PropTypes.func.isRequired,
dispatch: react_1.PropTypes.func.isRequired,
getState: react_1.PropTypes.func.isRequired,
}),
client: react_1.PropTypes.object.isRequired,
children: react_1.PropTypes.element.isRequired,
};
Provider.childContextTypes = {
store: react_1.PropTypes.object.isRequired,
client: react_1.PropTypes.object.isRequired,
};
return Provider;
}(react_1.Component));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Provider;
;
//# sourceMappingURL=Provider.js.map |