react-crouton
Advanced tools
Comparing version 0.0.7 to 0.1.0
@@ -58,3 +58,2 @@ /** | ||
event.preventDefault(); | ||
var self = this; | ||
var data = this.props.data | ||
@@ -68,6 +67,6 @@ if (data['onDismiss']) { | ||
if(button.listener) { | ||
button.listener = self.listener; | ||
button.listener = this.listener; | ||
} | ||
return button; | ||
}) | ||
}, this) | ||
} | ||
@@ -86,3 +85,2 @@ } | ||
render: function() { | ||
var self = this; | ||
return ( | ||
@@ -93,8 +91,8 @@ <div className='example'> | ||
doc={'<Crouton\n ' + | ||
(Object.keys(self.props.data).map(function(key){ | ||
var v = self.props.data[key]; | ||
(Object.keys(this.props.data).map(function(key){ | ||
var v = this.props.data[key]; | ||
return key + '="' + (typeof v === 'string' ? v : JSON.stringify(v)) + '"' | ||
}).join('\n ')) + | ||
}, this).join('\n ')) + | ||
'/>'} /> | ||
{self.props.data.onDismiss ? <span className='result'> { 'result: ' + (self.state.result || '') }</span>: null} | ||
{this.props.data.onDismiss ? <span className='result'> { 'result: ' + (this.state.result || '') }</span>: null} | ||
<button className='show' onClick={this.handleClick}>Show</button> | ||
@@ -167,3 +165,2 @@ </div>) | ||
render: function() { | ||
var self = this; | ||
return ( | ||
@@ -190,4 +187,4 @@ <div> | ||
{this.state.examples.map(function(example, i) { | ||
return <Example key={i} show={self.show} data={example}/> | ||
})} | ||
return <Example key={i} show={this.show} data={example}/> | ||
}, this)} | ||
</div> | ||
@@ -199,3 +196,3 @@ </div> | ||
React.renderComponent(<App />, document.body) | ||
React.renderComponent(<App />, document.getElementById('crouton-example')) | ||
22
index.js
@@ -46,2 +46,3 @@ /** | ||
} | ||
this.clearTimeout(); | ||
return this; | ||
@@ -51,4 +52,8 @@ }, | ||
clearTimeout: function() { | ||
if(this.state.ttd) | ||
clearTimeout(this.state.ttd) | ||
if (this.state.ttd) { | ||
clearTimeout(this.state.ttd); | ||
this.setState({ | ||
ttd: null | ||
}); | ||
} | ||
return this; | ||
@@ -58,3 +63,3 @@ }, | ||
handleClick: function(event) { | ||
this.dismiss().clearTimeout(); | ||
this.dismiss(); | ||
var item = this.state.buttons.filter(function(button){ | ||
@@ -74,3 +79,2 @@ return button.name.toLowerCase() === event.target.id | ||
var buttons = nextProps.buttons; | ||
var self = this; | ||
if (typeof buttons === 'string') | ||
@@ -102,6 +106,3 @@ buttons = [buttons]; | ||
if(autoMiss && !nextProps.hidden){ | ||
var ttd = setTimeout(function() { | ||
self.dismiss() | ||
}, this.state.timeout); | ||
var ttd = setTimeout(this.dismiss, this.state.timeout); | ||
this.setState({ | ||
@@ -125,3 +126,2 @@ ttd: ttd | ||
render: function() { | ||
var self = this; | ||
return ( | ||
@@ -141,4 +141,4 @@ <div className='crouton' hidden={this.state.hidden}> | ||
className={button.name.toLowerCase()} | ||
onClick={self.handleClick}>{button.name}</button> ) | ||
})}</div>: null | ||
onClick={this.handleClick}>{button.name}</button> ) | ||
}, this)}</div>: null | ||
@@ -145,0 +145,0 @@ } |
{ | ||
"name": "react-crouton", | ||
"version": "0.0.7", | ||
"version": "0.1.0", | ||
"description": "A message component for reactjs.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "npm test" | ||
}, | ||
"keywords": [ | ||
@@ -26,2 +23,9 @@ "react-component", | ||
}, | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"jest": { | ||
"scriptPreprocessor": "<rootDir>/preprocessor.js", | ||
"unmockedModulePathPatterns": ["<rootDir>/node_modules/react"] | ||
}, | ||
"author": "xeodou@gmail.com", | ||
@@ -39,5 +43,7 @@ "license": "MIT", | ||
"gulp-size": "^1.1.0", | ||
"jest-cli": "^0.1.18", | ||
"react": "^0.11.2", | ||
"react-tools": "^0.11.2", | ||
"reactify": "^0.14.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18628
10
437
0
13