mobx-react
Advanced tools
Comparing version 3.2.0 to 3.3.0
@@ -12,4 +12,3 @@ (function() { | ||
var componentByNodeRegistery = typeof WeakMap !== "undefined" ? new WeakMap() : undefined; | ||
var renderReporter = new mobx.SimpleEventEmitter(); | ||
var renderReporter = new EventEmitter(); | ||
function findDOMNode(component) { | ||
@@ -189,2 +188,20 @@ if (ReactDOM) | ||
function EventEmitter() { | ||
this.listeners = []; | ||
}; | ||
EventEmitter.prototype.on = function (cb) { | ||
this.listeners.push(cb); | ||
var self = this; | ||
return function() { | ||
var idx = self.listeners.indexOf(cb); | ||
if (idx !== -1) | ||
self.listeners.splice(idx, 1); | ||
}; | ||
}; | ||
EventEmitter.prototype.emit = function(data) { | ||
this.listeners.forEach(function (fn) { | ||
fn(data); | ||
}); | ||
}; | ||
return ({ | ||
@@ -191,0 +208,0 @@ observer: observer, |
21
index.js
@@ -12,4 +12,3 @@ (function() { | ||
var componentByNodeRegistery = typeof WeakMap !== "undefined" ? new WeakMap() : undefined; | ||
var renderReporter = new mobx.SimpleEventEmitter(); | ||
var renderReporter = new EventEmitter(); | ||
function findDOMNode(component) { | ||
@@ -189,2 +188,20 @@ if (ReactDOM) | ||
function EventEmitter() { | ||
this.listeners = []; | ||
}; | ||
EventEmitter.prototype.on = function (cb) { | ||
this.listeners.push(cb); | ||
var self = this; | ||
return function() { | ||
var idx = self.listeners.indexOf(cb); | ||
if (idx !== -1) | ||
self.listeners.splice(idx, 1); | ||
}; | ||
}; | ||
EventEmitter.prototype.emit = function(data) { | ||
this.listeners.forEach(function (fn) { | ||
fn(data); | ||
}); | ||
}; | ||
return ({ | ||
@@ -191,0 +208,0 @@ observer: observer, |
@@ -12,4 +12,3 @@ (function() { | ||
var componentByNodeRegistery = typeof WeakMap !== "undefined" ? new WeakMap() : undefined; | ||
var renderReporter = new mobx.SimpleEventEmitter(); | ||
var renderReporter = new EventEmitter(); | ||
function findDOMNode(component) { | ||
@@ -189,2 +188,20 @@ if (ReactDOM) | ||
function EventEmitter() { | ||
this.listeners = []; | ||
}; | ||
EventEmitter.prototype.on = function (cb) { | ||
this.listeners.push(cb); | ||
var self = this; | ||
return function() { | ||
var idx = self.listeners.indexOf(cb); | ||
if (idx !== -1) | ||
self.listeners.splice(idx, 1); | ||
}; | ||
}; | ||
EventEmitter.prototype.emit = function(data) { | ||
this.listeners.forEach(function (fn) { | ||
fn(data); | ||
}); | ||
}; | ||
return ({ | ||
@@ -191,0 +208,0 @@ observer: observer, |
{ | ||
"name": "mobx-react", | ||
"version": "3.2.0", | ||
"description": "React bindings for mobx. Create fully reactive components.", | ||
"version": "3.3.0", | ||
"description": "React bindings for MobX. Create fully reactive components.", | ||
"main": "index.js", | ||
@@ -24,3 +24,3 @@ "typings": "index", | ||
"peerDependencies": { | ||
"mobx": "^2.0.0" | ||
"mobx": "^2.2.0" | ||
}, | ||
@@ -31,3 +31,3 @@ "devDependencies": { | ||
"lodash": "^4.0.1", | ||
"mobx": "^2.0.0", | ||
"mobx": "^2.2.0", | ||
"react": "^15.0.0", | ||
@@ -34,0 +34,0 @@ "react-addons-test-utils": "^15.0.0", |
134
README.md
@@ -150,135 +150,1 @@ # mobx-react | ||
# Changelog | ||
### 3.2.0 | ||
* Added support for react-native 0.25 and higher. By @danieldunderfelt. | ||
### 3.1.0 | ||
* Added support for custom renderers (without DOM), use: `mobx-react/custom` as import fixes #42 | ||
* Fixed some issues with rollup #43 | ||
* Minor optimization | ||
### 3.0.5 | ||
Introduced `componentWillReact` | ||
### 3.0.4 | ||
The debug name stateless function components of babel transpiled jsx are now properly picked up if the wrapper is applied after defining the component: | ||
```javascript | ||
const MyComponent = () => <span>hi</span> | ||
export default observer(MyComponent); | ||
``` | ||
### 3.0.3 | ||
Removed peer dependencies, React 15 (and 0.13) are supported as well. By @bkniffler | ||
### 3.0.2 | ||
Removed the warning introduced in 3.0.1. It triggered always when using shallow rendering (when using shallow rendering `componentDidMount` won't fire. See https://github.com/facebook/react/issues/4919). | ||
### 3.0.1 | ||
Added warning when changing state in `getInitialState` / `constructor`. | ||
### 3.0.0 | ||
Upgraded to MobX 2.0.0 | ||
### 2.1.5 | ||
Improved typescript typings overloads of `observer` | ||
### 2.1.4 | ||
Added empty 'dependencies' section to package.json, fixes #26 | ||
### 2.1.3 | ||
Added support for context to stateless components. (by Kosta-Github). | ||
### 2.1.1 | ||
Fixed #12: fixed React warning when a component was unmounted after scheduling a re-render but before executing it. | ||
### 2.1.0 | ||
Upped dependency of mobx to 1.1.1. | ||
### 2.0.1 | ||
It is now possible to define `propTypes` and `getDefaultProps` on a stateless component: | ||
```javascript | ||
const myComponent = (props) => { | ||
// render | ||
}; | ||
myComponent.propTypes = { | ||
name: React.PropTypes.string | ||
}; | ||
myComponent.defaultProps = { | ||
name: "World" | ||
}; | ||
export default observer(myComponent); | ||
``` | ||
All credits to Jiri Spac for this contribution! | ||
### 2.0.0 | ||
Use React 0.14 instead of React 0.13. For React 0.13, use version `mobx-react@1.0.2` or higher. | ||
### 1.0.2 | ||
Minor fixes and improvements | ||
### 1.0.1 | ||
Fixed issue with typescript typings. An example project with MobX, React, Typescript, TSX can be found here: https://github.com/mobxjs/mobx-react-typescript | ||
### 1.0.0 | ||
`reactiveComponent` has been renamed to `observer` | ||
### 0.2.3 | ||
Added separte import for react-native: use `var reactiveComponent = require('mobx-react/native').reactiveComponent` for native support; webpack clients will refuse to build otherwise. | ||
### 0.2.2 | ||
Added react-native as dependency, so that the package works with either `react` or `react-native`. | ||
### 0.2.0 | ||
Upgraded to MobX 0.7.0 | ||
### 0.1.7 | ||
Fixed issue where Babel generated component classes where not properly picked up. | ||
### 0.1.6 | ||
`observer` now accepts a pure render function as argument, besides constructor function. For example: | ||
```javascript | ||
var TodoItem = observer(function TodoItem(props) { | ||
var todo = props.todo; | ||
return <li>{todo.task}</li>; | ||
}); | ||
``` | ||
### 0.1.5 | ||
observer is now defined in terms of side effects. | ||
### 0.1.4 | ||
Added support for React 0.14(RC) by dropping peer dependency |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39906
10
615
150