Created
May 31, 2016 20:36
-
-
Save edinsoncs/483c009298ece04a153232df19783859 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function initializeReact() { | |
| var corriendoEnReact = React.createClass({ | |
| render: function(){ | |
| var time = Math.round(this.props.elapsed / 100); | |
| var segundos = time / 10 + (time % 10 ? '' : '.0' ); | |
| var mensaje = 'Estamos corriendo: ' + segundos + ' Segundos'; | |
| return React.DOM.h2(null, mensaje); | |
| } | |
| }); | |
| var iniciar = React.createFactory(corriendoEnReact); | |
| var empezamos = new Date().getTime(); | |
| var closeItem = setInterval(function(){ | |
| ReactDOM.render(iniciar({elapsed: new Date().getTime() - empezamos}), document.getElementById("show")) | |
| }, 50); | |
| function stop() { | |
| var close = document.getElementById("close"); | |
| close.addEventListener('click', function() { | |
| clearInterval(closeItem); | |
| }); | |
| } | |
| stop(); | |
| } | |
| initializeReact(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment