Simple slot machine-like counter, inspired by Google Plus.
No dependencies. AMD and CJS compatible.
Works in modern browsers. Chrome, Firefox, Safari 6+, IE10+.
Adding to your HTML file:
<script src="/path_to_http_invoke/slotcount.js"></script>
with Bower
bower install slotcount
with Component
component install auchenberg/slotcount.js
var counter = new slotCount(container, initialCount);
counter.set(newCount);
counter.dispose();
var counter = new slotCount(document.querySelector('.counter-box'), 10);
setInterval(function() {
var random = Math.floor(Math.random() * 50);
counter.set(random);
}, 2000);
You can test the component implementation of slotCount.js with Mocha in your browser.
Make sure you run component build
and then point your browser locally to test/index.html
.
slotCount.js is a project by Kenneth Auchenberg
The MIT License (MIT)