mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-26 10:01:08 +12:00
code review of e9968713e4
This commit is contained in:
parent
e9968713e4
commit
65d62ec379
|
@ -32,10 +32,12 @@
|
||||||
|
|
||||||
var µm = µMatrix;
|
var µm = µMatrix;
|
||||||
var magicId = 'axyorpwxtmnf';
|
var magicId = 'axyorpwxtmnf';
|
||||||
|
var uniqueIdGenerator = 1;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var Matrix = function() {
|
var Matrix = function() {
|
||||||
|
this.id = uniqueIdGenerator++;
|
||||||
this.reset();
|
this.reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -556,14 +558,16 @@ Matrix.prototype.evaluateSwitchZ = function(switchName, srcHostname) {
|
||||||
|
|
||||||
Matrix.prototype.extractAllSourceHostnames = (function() {
|
Matrix.prototype.extractAllSourceHostnames = (function() {
|
||||||
var cachedResult = new Set();
|
var cachedResult = new Set();
|
||||||
|
var matrixId = 0;
|
||||||
var readTime = 0;
|
var readTime = 0;
|
||||||
|
|
||||||
return function() {
|
return function() {
|
||||||
if ( readTime !== this.modifiedTime ) {
|
if ( matrixId !== this.id || readTime !== this.modifiedTime ) {
|
||||||
cachedResult.clear();
|
cachedResult.clear();
|
||||||
for ( var rule of this.rules.keys() ) {
|
for ( var rule of this.rules.keys() ) {
|
||||||
cachedResult.add(rule.slice(0, rule.indexOf(' ')));
|
cachedResult.add(rule.slice(0, rule.indexOf(' ')));
|
||||||
}
|
}
|
||||||
|
matrixId = this.id;
|
||||||
readTime = this.modifiedTime;
|
readTime = this.modifiedTime;
|
||||||
}
|
}
|
||||||
return cachedResult;
|
return cachedResult;
|
||||||
|
|
Loading…
Reference in a new issue