Comparing version 1.0.0 to 1.0.1
@@ -24,3 +24,3 @@ /** | ||
*/ | ||
function stop(ctx, id) { | ||
function stop(ctx, id, preventCallback) { | ||
var result, | ||
@@ -35,3 +35,3 @@ timers = ctx[_TIMERS_PROP]; | ||
if (typeof _stopCallback === 'function') { | ||
if (preventCallback !== true && typeof _stopCallback === 'function') { | ||
setImmediate(function() { | ||
@@ -68,4 +68,4 @@ _stopCallback(id, result); | ||
var stopFn = function() { | ||
return stop(ctx, id); | ||
var stopFn = function(preventCallback) { | ||
return stop(ctx, id, preventCallback); | ||
}; | ||
@@ -72,0 +72,0 @@ |
{ | ||
"name": "contimer", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Routines to measure time in the context of an object.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -64,2 +64,17 @@ /* globals describe, it */ | ||
}); | ||
it('should not execute callback if 3rd argument is `true`', function(done) { | ||
var marker = true, | ||
ctx = {}; | ||
time.hook(function() { marker = false; }); | ||
time.start(ctx, TIMER_NAME); | ||
time.stop(ctx, TIMER_NAME, true); | ||
time.start(ctx, TIMER_NAME)(true); | ||
setTimeout(function() { | ||
assert(marker); | ||
done(); | ||
}, 5); | ||
}); | ||
}); | ||
@@ -66,0 +81,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15975
177