These are chat archives for highfidelity/hifi

10th
Jan 2017
Polyrhythm
@Polyrhythm
Jan 10 2017 06:38
i can answer that!! :)
the JS for high fidelity is a bit...weird
it's kinda sorta ES5 spec but without some browser-specific things for obvious reasons (no DOM selectors and such)
the one big difference is that at the moment, there is no commonjs import syntax, so no, you cannot use a node.js module that imports anything or uses module.exports syntax
the built-in hifi-specific syntax is this thing like script.include('./path_to_js.js')
i campaigned hard for commonJS syntax in an issue and i believe they are largely behind is and even have a worklist item for it, but the work has not really started on it
once commonJS support is in, you should be able to use any ES5 nodejs modules that don't rely on browser functionality
or run modern ES6 stuff through a transpiler
their JS engine is powered by Qt and there's basically no hope of that upgrading to ES6 anytime soon since it's all a custom implementation, so options for modern JS are really just to transpile it on the fly or switch to another JS engine