jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
951 stars 188 forks source link

WIP: Refactor JS into webpack sub-modules #55

Closed abelnation closed 6 years ago

abelnation commented 8 years ago

This is a WIP PR to demonstrate how I'd like to refactor the js code-base of pythreejs. I've only included a couple of modules to demonstrate the idea.

The reorganization would:

The index.js files in both the src dir and all subdirs can be automatically generated using the included scripts/write-index-files.js script.

@jasongrout @SylvainCorlay

SylvainCorlay commented 8 years ago

FYI, the examples directory contains js that assumes the THREE global variable exists as in old versions. This is why we defined THREE globally at the top of the jupyter-threejs file.

Besides, since we already go through a webpack bundling, one should be able to replace the amd style define syntax with a commonjs syntax in jupyter-threejs.js

abelnation commented 8 years ago

@SylvainCorlay If the number of three wrapped classes grows, it will be helpful to split them out to separate files, i.e. jupyter-threejs.js would get very very large.

I've removed the THREE requires from the submodules. The top-level index.js makes sure to require THREE and then set window.THREE.

vidartf commented 7 years ago

Is it OK to close this as outdated?