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