Stopwatch
This example shows a functional stopwatch application with a large digital time display and two buttons, one to toggle between Start and Stop states and another to Reset the timer. The interface is built entirely from reusable components defined with d3.component, and the app’s state is managed through Redux actions like START, STOP, and RESET. The time display updates continuously via d3.timer when running, and the visual formatting converts elapsed milliseconds into hours, minutes, seconds, and centiseconds using d3.format.
AI-generated descriptionA stopwatch app constructed using d3-component.
The following components are defined and used to construct the app:
app<br>The top-level app component. This serves as a "container component" that holds the state of the app, and exposes "actions" to children (similar pattern to Redux. This component manages an instance of d3-timer that keeps track of passing time. <br><br>buttonPanel<br>The panel that contains the two buttons. This shows a simple composition pattern in which props are passed through to child components. <br><br>resetButton<br>The button that says "Reset" and invokes theresetaction when clicked. <br><br>startStopButton<br>The button that either starts or stops (pauses) the stopwatch when clicked, depending on whether the stopwatch is running or not. <br><br>button<br> A generic Button component, used by bothresetButtonandstartStopButton. <br><br>timeDisplay<br> A display of the current time.
Built with blockbuilder.org
forked from <a href='http://bl.ocks.org/curran/'>curran</a>'s block: <a href='http://bl.ocks.org/curran/fc8f6989901628e2e79d6374849453ed'>Posts with d3-component</a>
<!-- Start of SimpleHitCounter Code --> <div align="center"><img src="http://simplehitcounter.com/hit.php?uid=2238980&f=16777215&b=0" border="0" height="18" width="83"></a><br></div> <!-- End of SimpleHitCounter Code -->