Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Fresh.mixins.SetInterval = {
componentWillMount: function() {
this.intervals = [];
},
setInterval: function() {
this.intervals.push(setInterval.apply(null, arguments));
},
componentWillUnmount: function() {
this.intervals.map(clearInterval);
}
};
/** @jsx React.DOM */
Fresh.components.Author = React.createClass({
/**
* Input: {
* component: 'Author',
* name: 'Dan Ciotu'
* }
*/
mixins: [Fresh.mixins.SetInterval,
Fresh.mixins.PersistState,
Fresh.mixins.DataManager],
render: function() {
return (
React.DOM.div(null, this.state.data.name)
);
}
});
* name: 'Dan Ciotu'
* }
*/
mixins: [Fresh.mixins.SetInterval,
Fresh.mixins.PersistState,
Fresh.mixins.DataManager],
render: function() {
return (
React.DOM.div(null, this.state.data.name)
);
}
});
/** @jsx React.DOM */
Fresh.components.List = React.createClass({
/**
* Input: {
* component: 'List',
* data: 'http://localhost/static/users.json'
* }
*/
mixins: [Fresh.mixins.SetInterval,
Fresh.mixins.PersistState,
Fresh.mixins.DataManager],
getInitialState: function() {
return {data: []};
},
render: function() {
return (
React.DOM.ul( {className:"List"},
this.state.data.map(function(item, index) {