Closed xeolabs closed 5 years ago
@xeolabs Are you planning on releasing this as an npm package too btw?
The unofficial one (https://www.npmjs.com/package/@wikifactory/xeogl) is still at v0.7.2
, so it would be nice to have an official package published 🙂
@MichaelDeBoey yip will do!
The xeogl ES6 branch is now largely working if anyone needs to preview it. Will merge into master when I've updated the docs. Feedback is super welcome, please comment in this issue if you have any questions or feedback.
Change docs (WIP): https://github.com/xeolabs/xeogl/wiki/Updates-in-xeogl-v0.9 Repo branch: https://github.com/xeolabs/xeogl/tree/es6
Rollup is building two versions of xeogl: a UMD module and an EC6 module, in the build dir: https://github.com/xeolabs/xeogl/tree/es6/build
The UMD version should work just like v0.8, ie. with a global xeogl
namespace.
BTW, the main breaking API change with this ES6 upgrade is that the default Scene is no longer settable/gettable via a property on the xeogl
namespace - now that's supported with a pair of setter and getter methods.
In v0.8 (EC5), it was:
// Get default scene, internally creating first if needed
var theDefaultScene = xeogl.scene;
// Set the default scene
xeogl.scene = new xeogl.Scene({... });
// Subsequently created components will be within xeogl.scene
// if no scene is explicitly provided for them.
In the EC6 conversion, xeogl.js is the rollup "input" file, which effectively assembles the xeogl namespace via a bunch of exports.
Unfortunately, you can't export an object property, the way xeogl.scene
was defined in v0.8.
Therefore, I was forced to replace that with setDefaultScene()
and getDefaultScene()
methods, which can be exported.
Accordingly, I needed to update a few examples that referenced that default Scene.
Maybe there's something I missed - some hacky thing I can do to keep that dynamic xeogl.property
?
Not sure, if anyone has tips let me know!
I've just released v0.9, which converts xeogl to #ECMA6 - https://github.com/xeolabs/xeogl/wiki/Updates-in-xeogl-v0.9
Next step: publish the core library as an npm package, along with some of the non-core components like GLTFModel. Just got some reading to do on all of that first.
Also use rollup, which will build xeogl as an ES6 module in
build/xeogl.module.js
, and as a UMD module inbuild/xeogl.js
.Doing the conversion in this branch: https://github.com/xeolabs/xeogl/tree/es6
Convert xeogl core to ES6Configure rollup to build library as ES6 module and UMD moduleConvert "extras" example components to ES6 classesUse gulp instead of grunt