Comparing version 2.2.0 to 2.3.0
v2.3.0 / 2017-11-08 | ||
================== | ||
* Stops leak of (request|cancel)AnimationFrame into global scope. (#143) | ||
* return timers on uninstall | ||
v2.2.0 / 2017-11-07 | ||
@@ -3,0 +9,0 @@ ================== |
22
lolex.js
@@ -36,2 +36,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.lolex = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var performancePresent = (global.performance && typeof global.performance.now === "function"); | ||
var requestAnimationFramePresent = (global.requestAnimationFrame && typeof global.requestAnimationFrame === "function"); | ||
var cancelAnimationFramePresent = (global.cancelAnimationFrame && typeof global.cancelAnimationFrame === "function"); | ||
@@ -398,2 +400,10 @@ clearTimeout(timeoutResult); | ||
clock.methods = []; | ||
// return pending timers, to enable checking what timers remained on uninstall | ||
if (!clock.timers) { | ||
return []; | ||
} | ||
return Object.keys(clock.timers).map(function mapper(key) { | ||
return clock.timers[key]; | ||
}); | ||
} | ||
@@ -435,4 +445,2 @@ | ||
clearInterval: clearInterval, | ||
requestAnimationFrame: global.requestAnimationFrame, | ||
cancelAnimationFrame: global.cancelAnimationFrame, | ||
Date: Date | ||
@@ -453,2 +461,10 @@ }; | ||
if (requestAnimationFramePresent) { | ||
timers.requestAnimationFrame = global.requestAnimationFrame; | ||
} | ||
if (cancelAnimationFramePresent) { | ||
timers.cancelAnimationFrame = global.cancelAnimationFrame; | ||
} | ||
var keys = Object.keys || function (obj) { | ||
@@ -728,3 +744,3 @@ var ks = []; | ||
clock.uninstall = function () { | ||
uninstall(clock, target, config); | ||
return uninstall(clock, target, config); | ||
}; | ||
@@ -731,0 +747,0 @@ |
{ | ||
"name": "lolex", | ||
"description": "Fake JavaScript timers", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"homepage": "http://github.com/sinonjs/lolex", | ||
@@ -18,3 +18,3 @@ "author": "Christian Johansen", | ||
"lint": "eslint .", | ||
"test-node": "mocha -R dot", | ||
"test-node": "mocha -R dot --check-leaks", | ||
"test-headless": "mochify", | ||
@@ -21,0 +21,0 @@ "test-cloud": "mochify --wd", |
@@ -34,4 +34,5 @@ # Rolling Lolex releases | ||
## Push new commits and tags | ||
> Assuming that `origin` points to `github.com/sinonjs/lolex` | ||
``` | ||
git push && git push --tags | ||
git push --follow-tags origin | ||
``` | ||
@@ -38,0 +39,0 @@ |
@@ -34,2 +34,4 @@ "use strict"; | ||
var performancePresent = (global.performance && typeof global.performance.now === "function"); | ||
var requestAnimationFramePresent = (global.requestAnimationFrame && typeof global.requestAnimationFrame === "function"); | ||
var cancelAnimationFramePresent = (global.cancelAnimationFrame && typeof global.cancelAnimationFrame === "function"); | ||
@@ -396,2 +398,10 @@ clearTimeout(timeoutResult); | ||
clock.methods = []; | ||
// return pending timers, to enable checking what timers remained on uninstall | ||
if (!clock.timers) { | ||
return []; | ||
} | ||
return Object.keys(clock.timers).map(function mapper(key) { | ||
return clock.timers[key]; | ||
}); | ||
} | ||
@@ -433,4 +443,2 @@ | ||
clearInterval: clearInterval, | ||
requestAnimationFrame: global.requestAnimationFrame, | ||
cancelAnimationFrame: global.cancelAnimationFrame, | ||
Date: Date | ||
@@ -451,2 +459,10 @@ }; | ||
if (requestAnimationFramePresent) { | ||
timers.requestAnimationFrame = global.requestAnimationFrame; | ||
} | ||
if (cancelAnimationFramePresent) { | ||
timers.cancelAnimationFrame = global.cancelAnimationFrame; | ||
} | ||
var keys = Object.keys || function (obj) { | ||
@@ -726,3 +742,3 @@ var ks = []; | ||
clock.uninstall = function () { | ||
uninstall(clock, target, config); | ||
return uninstall(clock, target, config); | ||
}; | ||
@@ -729,0 +745,0 @@ |
Sorry, the diff of this file is not supported yet
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
145866
16
3168