ANDI icon indicating copy to clipboard operation
ANDI copied to clipboard

It would be nice if andi.js was smaller

Open ollie-iterators opened this issue 2 years ago • 7 comments

I think it would be better for the code if one were able to split up the different modules in the code of andi.js (Like AndiOverlay, Utility, ...) so that it would be easier to understand the code and try to fix it.

ollie-iterators avatar Aug 05 '22 13:08 ollie-iterators

100% true, and definitely something I've wanted. I couldn't find an easy way to make the js compile together at runtime. Do you have a suggestion on how to do this?

JohnCotterSSA avatar Aug 19 '22 17:08 JohnCotterSSA

One suggestion I found was that you could include each of the files you want to use as script tags.

ollie-iterators avatar Aug 22 '22 14:08 ollie-iterators

That's a lot of trips to the server. Concerned it would reduce load speed.

JohnCotterSSA avatar Aug 22 '22 15:08 JohnCotterSSA

Here is an example repository about JavaScript modules: https://github.com/mdn/js-examples/tree/master/module-examples

ollie-iterators avatar Aug 22 '22 16:08 ollie-iterators

I have mostly finished the work that is needed for my branch of code that is about putting the andi objects code into different files and exporting them to where they are needed to run the program.

I only have 1 error that keeps coming up when I use the branch. It says for the modules (fandi.js, gandi.js, ...) that "import declarations may only appear at the top level of a module". NOTE: This error does not cause the code to fail, or cause any issues. It just shows up in the console.

One thing that I had to do was to change the init_module functions so that they started with the first letter of the modules (cinit_module for candi.js, finit_module for fandi.js, ...) because I had to export init_module to andi.js and eventually andiModule.js for it to work because importing something with the same name multiple times from different files does not work with JavaScript.

ollie-iterators avatar Nov 02 '22 13:11 ollie-iterators

@JohnCotterSSA, I used the code in this repository: https://github.com/mdn/js-examples as a way to learn about exporting code into other files using JavaScript.

ollie-iterators avatar Nov 09 '22 23:11 ollie-iterators

If you are worried about load speed, you could check out some things to improve the speed of the JavaScript code

ollie-iterators avatar Nov 15 '22 17:11 ollie-iterators