You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently rollup does not attempt to prune class methods due to the dynamic nature of the language, and it seems that even if it did, it would have to be really conservative about it (rollup/rollup#349). This means that our current API does not tree-shake well: Device is a class with a lot of methods that utilize imports from the rest of the library.
This is what the API could look like with plain functions:
import*asgffrom"webglutenfree"constdev=gf.createDevice();// or gf.createDevice(canvas) or gf.createDevice(gl)constcmd=gf.createCommand(dev,vertexShader,fragmentShader,options);constattrs=gf.createAttributes(dev,primitive,attributeData);gf.target(dev,(rt)=>{gf.draw(rt,cmd,attrs);});
We could potentially keep methods that don't make use of imports, or move everything into functions for more consistency.
The text was updated successfully, but these errors were encountered:
The tree-shaking optimized version is roughly 67% to 70% of the current size, making this desirable to have.
Since the change would be a major API change and the new API would have to be either less straightforward (some operations would be functions, some methods), or less simple (making every operation a function would make it harder to tell which functions are associated with what data types), I won't pursue this for 0.1.0, but may possibly revisit later.
Currently
rollup
does not attempt to prune class methods due to the dynamic nature of the language, and it seems that even if it did, it would have to be really conservative about it (rollup/rollup#349). This means that our current API does not tree-shake well:Device
is a class with a lot of methods that utilize imports from the rest of the library.This is what the API could look like with plain functions:
We could potentially keep methods that don't make use of imports, or move everything into functions for more consistency.
The text was updated successfully, but these errors were encountered: