ensl_gathers/app/javascripts/components/snowMachine.js
Chris Blanchard 1720f0a513 Spike
2016-04-19 00:59:05 +01:00

36 lines
609 B
JavaScript

const React = require("react");
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>
);
}
});