fluent-time
Advanced tools
Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "fluent-time", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"main": ["./fluent-time.js"] | ||
} |
@@ -213,3 +213,3 @@ | ||
// exist | ||
if (typeof(module) !== 'undefined' && module.exports) { | ||
if (typeof(module) !== 'undefined') { | ||
module.exports = FluentTime; | ||
@@ -216,0 +216,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/*! fluent-time - v0.0.7 */ | ||
(function(){"use strict";var e=function(e,t){for(var n in e.prototype)t.prototype[n]=e.prototype[n]},t={every:function(e){return new t.Interval(e)},after:function(e){return new t.TimeOut(e)}};t.TimeLeap=function(e){this.leap=e,this.ms=0},t.TimeLeap.prototype.days=function(e){return this.ms+=this.leap*864e5,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.hours=function(e){return this.ms+=this.leap*36e5,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.minutes=function(e){return this.ms+=this.leap*6e4,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.seconds=function(e){return this.ms+=this.leap*1e3,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.milliseconds=function(e){return this.ms+=this.leap,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.and=function(e){return this.leap=e,this},t.TimeLeap.prototype.finalizeIfCallback=function(e){e&&typeof e=="function"&&this.schedule(e,this.ms)},t.TimeLeap.prototype.occurs=function(){return new Date(Date.now()+this.ms)},t.TimeLeap.prototype.schedule=function(e){},t.TimeOut=function(e){t.TimeLeap.apply(this,arguments)},e(t.TimeLeap,t.TimeOut),t.TimeOut.prototype.schedule=function(e){var t=this;this.timeout=setTimeout(function(){e(t)},this.ms)},t.TimeOut.prototype.cancel=function(){this.timeout&&clearTimeout(this.timeout)},t.Interval=function(e){t.TimeOut.apply(this,arguments),this.times=0,this.skippingNext=0},e(t.TimeOut,t.Interval),t.Interval.prototype.schedule=function(e,t){var n=this;this.timeout=setTimeout(function(){n.times++;var t=Date.now();n.skippingNext?n.skippingNext--:e(n);var r=Math.max(0,n.ms-(Date.now()-t));n.schedule(e,r)},t)},t.Interval.prototype.skip=function(e){if(typeof e=="undefined")e=1;else if(typeof e!="number"||e<1)throw new Error("You must provide a non negative number");return this.skippingNext+=e,this},typeof module!="undefined"&&module.exports?module.exports=t:window.FluentTime=t})(); | ||
/*! fluent-time - v0.0.9 */ | ||
(function(){"use strict";var e=function(e,t){for(var n in e.prototype)t.prototype[n]=e.prototype[n]},t={every:function(e){return new t.Interval(e)},after:function(e){return new t.TimeOut(e)}};t.TimeLeap=function(e){this.leap=e,this.ms=0},t.TimeLeap.prototype.days=function(e){return this.ms+=this.leap*864e5,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.hours=function(e){return this.ms+=this.leap*36e5,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.minutes=function(e){return this.ms+=this.leap*6e4,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.seconds=function(e){return this.ms+=this.leap*1e3,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.milliseconds=function(e){return this.ms+=this.leap,this.leap=0,this.finalizeIfCallback(e),this},t.TimeLeap.prototype.and=function(e){return this.leap=e,this},t.TimeLeap.prototype.finalizeIfCallback=function(e){e&&typeof e=="function"&&this.schedule(e,this.ms)},t.TimeLeap.prototype.occurs=function(){return new Date(Date.now()+this.ms)},t.TimeLeap.prototype.schedule=function(e){},t.TimeOut=function(e){t.TimeLeap.apply(this,arguments)},e(t.TimeLeap,t.TimeOut),t.TimeOut.prototype.schedule=function(e){var t=this;this.timeout=setTimeout(function(){e(t)},this.ms)},t.TimeOut.prototype.cancel=function(){this.timeout&&clearTimeout(this.timeout)},t.Interval=function(e){t.TimeOut.apply(this,arguments),this.times=0,this.skippingNext=0},e(t.TimeOut,t.Interval),t.Interval.prototype.schedule=function(e,t){var n=this;this.timeout=setTimeout(function(){n.times++;var t=Date.now();n.skippingNext?n.skippingNext--:e(n);var r=Math.max(0,n.ms-(Date.now()-t));n.schedule(e,r)},t)},t.Interval.prototype.skip=function(e){if(typeof e=="undefined")e=1;else if(typeof e!="number"||e<1)throw new Error("You must provide a non negative number");return this.skippingNext+=e,this},typeof module!="undefined"?module.exports=t:window.FluentTime=t})(); |
@@ -5,3 +5,3 @@ { | ||
"description": "a fluent api making it easier work with intervals and timeouts", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"keywords": [ | ||
@@ -30,3 +30,5 @@ "util", | ||
"grunt-bump": "0.0.1", | ||
"grunt-docco": "~0.1.2" | ||
"grunt-docco": "~0.1.2", | ||
"grunt-mocha": "~0.1.7", | ||
"chai": "~1.5.0" | ||
}, | ||
@@ -33,0 +35,0 @@ "optionalDependencies": {}, |
@@ -15,3 +15,3 @@ # fluent-time.js [![Build Status](https://secure.travis-ci.org/ullmark/fluent-time.js.png?branch=master)](http://travis-ci.org/ullmark/fluent-time.js) | ||
#### the old fashion way | ||
#### regular include | ||
download `fluent-time.js` or `fluent-time.min.js` and include it. | ||
@@ -68,3 +68,5 @@ | ||
## Annotated Source | ||
## Tests | ||
the tests are written in [mocha](http://visionmedia.github.com/mocha/) and are tested in both node | ||
and browser using [phantomjs](http://phantomjs.org/) (although travis only runs the node version). | ||
@@ -71,0 +73,0 @@ ## License |
51872
95
7