redux-zero
Advanced tools
Comparing version 1.1.0 to 2.0.0
# Changelog | ||
### 2.0.0 | ||
- Changing Provider API to accept store as a prop instead of context. | ||
### 1.1.0 | ||
- Removing PropTypes |
import Store from "./Store"; | ||
export default interface Props { | ||
context: { | ||
store: Store; | ||
}; | ||
store: Store; | ||
} |
@@ -122,3 +122,4 @@ 'use strict'; | ||
Provider.prototype.getChildContext = function () { | ||
return this.props.context; | ||
var store = this.props.store; | ||
return { store: store }; | ||
}; | ||
@@ -125,0 +126,0 @@ Provider.prototype.render = function () { |
@@ -118,3 +118,4 @@ import { Children, Component, createElement } from 'react'; | ||
Provider.prototype.getChildContext = function () { | ||
return this.props.context; | ||
var store = this.props.store; | ||
return { store: store }; | ||
}; | ||
@@ -121,0 +122,0 @@ Provider.prototype.render = function () { |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t["redux-zero"]={},t.React)}(this,function(t,e){"use strict";function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function r(t,e){for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}function o(t,e,n){return"object"==typeof t?null:new Error("Invalid prop "+e+" supplied to "+n)}var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},c=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return n(r,t),r.prototype.getChildContext=function(){return this.props.context},r.prototype.render=function(){var t=this.props.children;return e.Children.only(t)},r.childContextTypes={store:o},r}(e.Component);t.createStore=function(t){void 0===t&&(t={});var e=[];return{setState:function(n){t=u({},t,n),e.forEach(function(e){return e(t)})},subscribe:function(t){e.push(t)},unsubscribe:function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},getState:function(){return t}}},t.connect=function(t){return function(i){return c=function(o){function c(){var t=null!==o&&o.apply(this,arguments)||this;return t.state=t.getProps(),t.update=function(){var e=t.getProps();r(e,t.state)||t.setState(e)},t}return n(c,o),c.prototype.componentWillMount=function(){this.context.store.subscribe(this.update)},c.prototype.componentWillUnmount=function(){this.context.store.unsubscribe(this.update)},c.prototype.getProps=function(){var e=this.context.store&&this.context.store.getState()||{};return t(e,this.props)},c.prototype.render=function(){return e.createElement(i,u({store:this.context.store},this.props,this.state))},c}(e.Component),c.contextTypes={store:o},c;var c}},t.Provider=c,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t["redux-zero"]={},t.React)}(this,function(t,e){"use strict";function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function r(t,e){for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}function o(t,e,n){return"object"==typeof t?null:new Error("Invalid prop "+e+" supplied to "+n)}var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},s=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return n(r,t),r.prototype.getChildContext=function(){return{store:this.props.store}},r.prototype.render=function(){var t=this.props.children;return e.Children.only(t)},r.childContextTypes={store:o},r}(e.Component);t.createStore=function(t){void 0===t&&(t={});var e=[];return{setState:function(n){t=u({},t,n),e.forEach(function(e){return e(t)})},subscribe:function(t){e.push(t)},unsubscribe:function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},getState:function(){return t}}},t.connect=function(t){return function(i){return s=function(o){function s(){var t=null!==o&&o.apply(this,arguments)||this;return t.state=t.getProps(),t.update=function(){var e=t.getProps();r(e,t.state)||t.setState(e)},t}return n(s,o),s.prototype.componentWillMount=function(){this.context.store.subscribe(this.update)},s.prototype.componentWillUnmount=function(){this.context.store.unsubscribe(this.update)},s.prototype.getProps=function(){var e=this.context.store&&this.context.store.getState()||{};return t(e,this.props)},s.prototype.render=function(){return e.createElement(i,u({store:this.context.store},this.props,this.state))},s}(e.Component),s.contextTypes={store:o},s;var s}},t.Provider=s,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=redux-zero.min.js.map |
{ | ||
"name": "redux-zero", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/redux-zero.cjs.js", |
@@ -12,3 +12,4 @@ # redux-zero | ||
![](http://img.badgesize.io/concretesolutions/redux-zero/master/dist/redux-zero.min.js?style=flat-square) | ||
![](http://img.badgesize.io/concretesolutions/redux-zero/master/dist/redux-zero.min.js?compression=gzip&style=flat-square) | ||
[![build](https://img.shields.io/travis/concretesolutions/redux-zero/master.svg?style=flat-square)](https://travis-ci.org/concretesolutions/redux-zero) | ||
@@ -122,3 +123,3 @@ [![npm](https://img.shields.io/npm/v/redux-zero.svg?style=flat-square)](https://www.npmjs.com/package/redux-zero) | ||
const App = () => ( | ||
<Provider context={{ store }}> | ||
<Provider store={store}> | ||
<Counter /> | ||
@@ -137,11 +138,10 @@ </Provider> | ||
## Roadmap | ||
- Remove PropTypes | ||
- Improving integration with Preact | ||
- Propertly use TypeScript | ||
- Improve integration with Preact | ||
- Remove the context API | ||
## Docs | ||
* [Contributing](https://github.com/concretesolutions/redux-zero.js/blob/master/CONTRIBUTING.md) | ||
* [Changelog](https://github.com/concretesolutions/redux-zero.js/blob/master/CHANGELOG.md) | ||
* [Code of Conduct](https://github.com/concretesolutions/redux-zero.js/blob/master/CODE_OF_CONDUCT.md) | ||
* [License](https://github.com/concretesolutions/redux-zero.js/blob/master/LICENSE.md) | ||
* [Contributing](https://github.com/concretesolutions/redux-zero/blob/master/CONTRIBUTING.md) | ||
* [Changelog](https://github.com/concretesolutions/redux-zero/blob/master/CHANGELOG.md) | ||
* [Code of Conduct](https://github.com/concretesolutions/redux-zero/blob/master/CODE_OF_CONDUCT.md) | ||
* [License](https://github.com/concretesolutions/redux-zero/blob/master/LICENSE.md) |
import Store from "./Store" | ||
export default interface Props { | ||
context: { | ||
store: Store | ||
} | ||
store: Store | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
47541
630