ensl_gathers/app/javascripts/components/snowMachine.js

37 lines
609 B
JavaScript
Raw Normal View History

2016-01-22 10:12:23 +00:00
const React = require("react");
2015-12-08 11:16:27 +00:00
var SnowMachineMenu = React.createClass({
getInitialState() {
return {
snowMachine: null
}
},
componentDidMount() {
const snowMachine = new SnowMachine();
snowMachine.start();
this.setState({ snowMachine: snowMachine });
},
toggle() {
const snowMachine = this.state.snowMachine;
if (snowMachine.timer) {
snowMachine.stop();
} else {
snowMachine.start();
}
},
render() {
return (
<ul className="nav navbar-top-links navbar-right">
<li>
<a href="#" onClick={this.toggle}>
Snow
</a>
</li>
</ul>
);
}
});