enhanced-resolve
Advanced tools
Comparing version 0.5.4 to 0.5.5
@@ -9,9 +9,12 @@ /* | ||
this.data = {}; | ||
this.levels = duration > 0 ? [[], [], [], [], []] : []; | ||
this.levels = duration > 0 ? [[], [], [], [], [], [], [], [], []] : []; | ||
this.count = 0; | ||
this.interval = null; | ||
this.needTickCheck = false; | ||
this.nextTick = null; | ||
this.passive = true; | ||
} | ||
Storage.prototype.ensureTick = function() { | ||
if(!this.interval && this.duration > 0) | ||
if(!this.interval && this.duration > 0 && !this.nextTick) | ||
this.interval = setInterval(this.tick.bind(this), Math.floor(this.duration / this.levels.length)); | ||
@@ -42,2 +45,3 @@ }; | ||
if(this.duration > 0) { | ||
this.checkTicks(); | ||
var data = this.data[name]; | ||
@@ -58,13 +62,37 @@ if(data) { | ||
this.count -= decay.length; | ||
decay.length = 0; | ||
this.levels.unshift(decay); | ||
if(this.count == 0) { | ||
clearInterval(this.interval); | ||
this.interval = null; | ||
this.nextTick = null; | ||
return true; | ||
} else if(this.nextTick) { | ||
this.nextTick += Math.floor(this.duration / this.levels.length); | ||
var time = new Date().getTime(); | ||
if(this.nextTick > time) { | ||
this.nextTick = null; | ||
this.interval = setInterval(this.tick.bind(this), Math.floor(this.duration / this.levels.length)); | ||
return true; | ||
} | ||
} else if(this.passive) { | ||
clearInterval(this.interval); | ||
this.interval = null; | ||
this.nextTick = new Date().getTime() + Math.floor(this.duration / this.levels.length); | ||
} else { | ||
this.passive = true; | ||
} | ||
decay.length = 0; | ||
this.levels.unshift(decay); | ||
}; | ||
Storage.prototype.checkTicks = function() { | ||
this.passive = false; | ||
if(this.nextTick) { | ||
while(!this.tick()); | ||
} | ||
}; | ||
Storage.prototype.purge = function() { | ||
this.count = 0; | ||
clearInterval(this.interval); | ||
this.nextTick = null; | ||
this.data = {}; | ||
@@ -71,0 +99,0 @@ this.levels.forEach(function(level) { |
{ | ||
"name": "enhanced-resolve", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Offers a async require.resolve function. It's highly configurable.", |
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
48140
57
1408