-
Notifications
You must be signed in to change notification settings - Fork 980
Description
Typescript conversion or simply type definitions?
Adding modularity to AR.js
We converted AR.js to ES6 and we have a npm package that can be imported in many projects and frameworks, but if you need to import into a Typescript project it became hard and you enter into a lot of troubles. I thought to add type definitions, it's possible witing the documentation in JSDoc to the actual code and transpiling to Typescript. I'm doing this in #506 but i realized that we need also to convert the entire code to real ES6 standard. But why not convert directly to Typescript? If we do so, we can add also more modularity to the project, I already started this task - you can see in this repository AR.js-threex (see my comment in POST EDIT). I named it AR.js-threex but maybe we can find a more appropriate name, Initially i thought that we should develop two separate package (as the "namespaces": ARjs and THREEx) But maybe this can add a complexity that we don't need. Probably a better name will be AR.js-threejs (as the name of the folder in AR.js) but if you have a better idea let me know.
I plan to move AR.js-threex (or with the new name) in few days to the AR.js org and when it will be possible also release a first npm pacakge for testing.
POST EDIT: Now i renamed it as AR.js-threejs
Project design
Convert all the existent three.js classes ( i mean code in the AR.js three.js
folder) to a Typesctipt version. For a list of created classes:
THREEx:
- ArBaseControls
- ArClickability
- ArMarkerCloak
- ArMarkerHelper
- ArMarkerControls
- ArSmoothedControls
- ArToolkitContext
- ArToolkitSource
- ArToolkitProfile
- ArVideoinwebgl
- HittestingPlane
ARjs:
- Source
- Context
- Profile
new-api:
- Anchor
- Debugui
- Hittesting
- Session
- Utils
markers-area:
- MarkersAreaControls
- MarkersAreaLearning
- MarkersAreaUtils
Final conclusion
The idea is when it will be ready also to import it as a npm module into AR.js itself and remove the threejs folder as it will be unecessary. I can not say when this will became a reality but i hope that we can do in a short time. If you have experience with Typescript any help and collaboration is appreciated! I don't know what think @nickw1 and @nicolocarpignoli about this but i hope that they can help in some way.
I will update this issue with the progresses in this task and, time permitting, i will aslo try to describe the plan for converting the code.
I know also that not all developers know or love Typescript, but the final distribution library is javascript code and you will be able to use as before. I hope that you will understand this.