0.3.1 • Published 11 years ago

compulsive v0.3.1

Weekly downloads
4
License
-
Repository
github
Last release
11 years ago

compulsive

Time based process

Getting Started

Install the module with: npm install compulsive

Documentation

compulsive.wait( ms, callback )

Wait ms, execute callback.

compulsive.loop( ms, callback )

Loop ms, execute callback.

compulsive.peat( count, ms, callback )

Repeat count times, every ms, execute callback.

compulsive.queue( list )

Queue tasks.

// list
[
  {
    wait: ms,
    task: function() {}
  }
  ...
]

Examples

var compulsive = require('compulsive');


compulsive.wait( 10, function() {

  // Will execute in 10ms
  // ... doesn't use setTimeout.

});

compulsive.loop( 50, function( control ) {

  // Will execute every 50ms
  // ... doesn't use setTimeout or setInterval.


  // The loop can be stopped via:
  control.stop();
});

compulsive.repeat( 5, 100, function( control ) {

  // Will execute 5 times, every 100ms
  // ... doesn't use setTimeout or setInterval.


  // The repeater loop can be stopped via:
  control.stop();
});


compulsive.queue([
  {
    wait: 100,
    task: function() {
      // 100 from call to execution
    }
  },
  {
    wait: 200,
    task: function() {
      // 100 + 200 = 300ms from call to execution
    }
  }
]);

Contributing

All contributions must adhere to the the Idiomatic.js Style Guide, by maintaining the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

License

Copyright (c) 2012 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license.

0.3.1

11 years ago

0.3.0

11 years ago

0.2.3

12 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago