Sindarius / npm_gcodeviewer

Prefer var declarations be placed at the top of their scope JS-0102
Anti-pattern
Minor
3 months agoa year old
All 'var' declarations must be at the top of the function scope
 868               }
 869
 870               if (this.colorMode !== ColorMode.Feed) {
 871                  var extruder = Number(tokenString.substring(1)) % this.extruderCount; 872                  if (extruder < 0) extruder = 0;
 873                  this.currentColor = this.tools[extruder]?.color?.clone() ?? new Color3(1, 0, 0);
 874               }
All 'var' declarations must be at the top of the function scope
 929
 930   chunk(arr, chunkSize) {
 931      var R = [];
 932      for (var i = 0, len = arr.length; i < len; i += chunkSize) R.push(arr.slice(i, i + chunkSize)); 933      return R;
 934   }
 935
All 'var' declarations must be at the top of the function scope
 626         return;
 627      }
 628
 629      var lines = file.split('\n'); 630
 631      //Extract metadata from slicer to set render settings
 632      this.slicer.processComments(lines, this);
All 'var' declarations must be at the top of the function scope
24    var dynamicTexture = new DynamicTexture('DynamicTexture', 50, this.scene, true); 
25    dynamicTexture.hasAlpha = true; 
26    dynamicTexture.drawText(text, 5, 40, 'bold 36px Arial', color, 'transparent', true); 
27    var plane = Mesh.CreatePlane('TextPlane', size, this.scene, true); 28    plane.material = new StandardMaterial('TextPlaneMaterial', this.scene); 
29    plane.material.backFaceCulling = false; 
30    plane.material.specularColor = new Color3(0, 0, 0); 
All 'var' declarations must be at the top of the function scope
 89  box.material= edgeMaterial; 
 90} 
 91 
 92var ViewBoxCallback;  93 
 94export function registerViewBoxCallback(func) { 
 95  ViewBoxCallback = func;