Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
emerleite committed Dec 13, 2011
1 parent e12fa04 commit e8bd18e
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions Readme.md
Expand Up @@ -16,32 +16,31 @@ Instalation
Usuage
------
To create a stopwatch you only need a identifier and you can pass a hash with options with the stopwatch seconds and the interval (in miliseonds) if you want to reduce your stopwatch interval. The default is 1000 miliseconds (or 1 second).
> var Stopwatch = require('stopwatch').Stopwatch;
> var stopwatch = new Stopwatch(1, { seconds: 60, interval:10 });
> stopwatch.on('tick', function(secondsLeft) {
> //when one second pass.
> });
> stopwatch.on('end, function() {
> //when the time ends
> });
var Stopwatch = require('stopwatch').Stopwatch;
var stopwatch = new Stopwatch(1, { seconds: 60, interval:10 });
stopwatch.on('tick', function(secondsLeft) {
//when one second pass.
});
stopwatch.on('end, function() {
//when the time ends
});

### Managed
If you want a managed instance you only need to require the module and use the get function.
> var StopwatchManager = require('stopwatch');
> var stopwatch = StopwatchManager.get(1, {seconds: 1, interval: 0});
> stopwatch.on('tick', function(secondsLeft) {
> //when one second pass.
> });
> stopwatch.on('end, function() {
> //when the time ends
> });
var StopwatchManager = require('stopwatch');
var stopwatch = StopwatchManager.get(1, {seconds: 1, interval: 0});
stopwatch.on('tick', function(secondsLeft) {
//when one second pass.
});
stopwatch.on('end, function() {
//when the time ends
});

### Examples
See the test folder. I'll write more example in a examples folder.

Running tests
-------------
To run the tests you need to install mocha and should.
> npm install
> npm test
npm install
npm test

0 comments on commit e8bd18e

Please sign in to comment.