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