Please use ES6 for game.LOG: pwfisher@1a24cda
game.LOG = (level, ...rest) => level < _log_level && console.log(...rest);
This is painful:
|
game.LOG = function ( a,b,c,d,e,f,g,h,i ) { |
game.LOG = function ( a,b,c,d,e,f,g,h,i ) {
if (a > _log_level ) return ;
var log = console.log;
if (i !== undefined) { log (b,c,d,e,f,g,h,i); return ;}
if (h !== undefined) { log (b,c,d,e,f,g,h); return ;}
if (g !== undefined) { log (b,c,d,e,f,g); return ;}
if (f !== undefined) { log (b,c,d,e,f); return ;}
if (e !== undefined) { log (b,c,d,e); return ;}
if (d !== undefined) { log (b,c,d); return ;}
if (c !== undefined) { log (b, c ); return ;}
log( b );
};
Why not use ES6? It's 2020. ES6 is vanilla javascript. No need to restrict yourself an archaic style.
Sticking with ES5 only gets you IE11 support and you can get that with webpack if you need it for some reason, and still author ES6 for more readable (better) code.
If you want to be readable:
// level = priority rank (0 = error, 1 = alert, 2 = warning, 3 = info, 4 = debug)
// _log_level = verbosity setting
game.LOG = function (level, ...rest) {
if (level < _log_level) console.log(...rest);
};
ES6 and formatting
Automate code formatting. Use Prettier with VSCode: pwfisher@e3a515b
Multiline interpolated string wanted:
|
html = '<div><div class="inl-bl"><span onanimationend="GAME.ACTIONS.nextLine(this,' + line_delay + ')" class="' + clss + extra_class + '">' + target_txt + '</span></div></div>'; |
Key/property shorthand wanted:
|
var ASM_stdlib = { Math: Math, Float64Array: Float64Array, Uint8Array: Uint8Array, Uint32Array: Uint32Array }; |
const ASM_stdlib = { Math, Float64Array, Uint8Array, Uint32Array };
Please use ES6 for game.LOG: pwfisher@1a24cda
This is painful:
css3d-game/3d/js/engine.js
Line 798 in dc3ff4a
Why not use ES6? It's 2020. ES6 is vanilla javascript. No need to restrict yourself an archaic style.
Sticking with ES5 only gets you IE11 support and you can get that with webpack if you need it for some reason, and still author ES6 for more readable (better) code.
If you want to be readable:
ES6 and formatting
Automate code formatting. Use Prettier with VSCode: pwfisher@e3a515b
Multiline interpolated string wanted:
css3d-game/3d/js/engine.js
Line 729 in dc3ff4a
Key/property shorthand wanted:
css3d-game/3d/js/level.js
Line 956 in dc3ff4a