Browse Source

code review of e9968713e4

pull/2/head
gorhill 7 years ago
parent
commit
65d62ec379
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 6
      src/js/matrix.js

6
src/js/matrix.js

@ -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…
Cancel
Save