B4J Library [BANano v3 RC1] The next iteration...

For the last month, I have been working hard on the next iteration of BANano: v3, codename Pisang.

And it has all been about slimming down the generated javascript code to speed up your WebApps/Websites!

I've been running a lot of tests on my own projects/libraries and some results are quite spectacular:
e.g. for the ChatNoir website demo, the size of the generated javascript went down from 116Kb to 63Kb.

A lot depends on how modular the Library Author has organized his code. I will write a Tutorial with tips once BANano has been released to optimize writing BANano libraries.

NOTE: Because the Transpiler gets more and more options, I created a new object BANano.TranspilerOptions that hosts those options. The old ones are marked DEPRECIATED (they still work, but will eventually be removed). A warning is shown.



Huge chunks of the Transpiler have been rewritten so it is smart enough to do some cool stuff:

In the final generated app (Build, Release mode):
1. Remove classes
2. Remove dead methods code: Options -> ShowWarningsDeadCode & RemoveDeadCode
3. Rename variables to short versions



Other:
1. possibility to merge CSS and Javascript files
2. Minify CSS files online
3. BANano.DependsOnAsset: When creating e.g. a Custom View, you can set if it Depends on certain CSS, Javascript or other asset files. For CSS and Javascript, you must still use the AddCSSFile & AddJavascriptFile in AppStart of course, but they may be omitted from the final app if they are not needed.
4. CHANGE: UseServiceWorker is now by default false. You will have to set it to True if you want to use a Service worker.

Moreover, the preferred way of making a BANano V3 library is now the .b4xlib. Such libraries contain the source code, which allows BANano to do the same cool tricks as described above on the code in the libraries you use in your final app

Making a .b4xlib is very simple:

Just replace:
B4X:
BANano.BuildAsLibrary
With:
B4X:
BANano.BuildAsB4Xlib("1.01")

Such a .b4xlib has other advantages over their .jar versions:

1. No need for the user to copy the Libraries \Files to their app \Files
2. It is a one step thing (no need to run + compile to library any more)
3. No need for the user to AddCSSFile/AddJavascript file, this happens automatically. The user has only to worry about his own CSS/JS files

For the adventurous amongst you, a download of RC1 of the library can be found here:

http://gorgeousapps.com/BANano3.08RC1_190605.zip

Library only, contains no examples. But the V2 versions, see https://www.b4x.com/android/forum/t...-abstract-designer-support.99740/#post-627764 can be used and updated. The final version will have the updated demos.

This is RC1, so things can go wrong: TAKE A BACKUP!

Comments on this release? Please use the tag [BANano v3 RC1] in the subject. Thanks!

Alwaysbusy
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…