stackmat.js - use the Stackmat timer on the Web

tim

Master
Joined
Nov 22, 2006
Messages
1,692
Location
Karlsruhe, Germany
WCA ID
2007HABE01
YouTube
Visit Channel
Hey!

Since I make great use of mark2 for Cubemania, I'd like to give something back to the community:
I spent my entire Saturday hacking on a small library which provides access to the Stackmat timer from within JavaScript (no Flash or Java required!). This is done by using the HTML5 Web Audio API.

Supported browsers:
* Chrome (version > 21)

A quick demo: http://jsfiddle.net/q97Zc/

Github link: https://github.com/timhabermaas/stackmat.js

Be aware: It's still pre-alpha — in fact it doesn't even have a version number, yet. So, it's probably totally broken.

I'm not too happy with the public API. Maybe polling for updates instead of firing callbacks is more convenient? I'd like to hear some feedback! :)

Big thanks to:
- Florian W. for his documentation on the Stackmat protocol: http://hackvalue.de/hv_atmel_stackmat
- Walter for PPT. I peeked more than once into his stackmat code.
- Vino for his idea of using the Audio API in combination with a Stackmat timer.
- Thomas Müller for lending me his Stackmat timer. :)
 
Last edited:
Yeah, whoops. That probably shouldn't have gotten committed.

I think polling is more appropriate than callbacks for someone rendering the time. A properly written program will have its own rendering thread (using requestAnimationFrame if they're really on top of things).

It would be nice to be able to register callbacks for events like "timer started", "timer stopped", "timer reset", "hands changed", however.
 
Yep, I'm interested. I'll give it a shot next week since I'm quite busy right now.

In the meantime: What's this line for? Avoiding the browser's cache?

Could a working example be created? I've been trying to configure this, including trying the example and both don't work. Help would be appreciated.
 
Back
Top