-
• #2
Yes, there is - just ensure you have the
"ram"
keyword at the front of the function and Espruino will pretokenise it and remove whitespace. It won't exactly minify (renaming vars) because there is no minifier in Espruino, but it will really help.Either that or for the kind of code you have there in the interval you could even add
"jit"
to it to compile it to native code. -
• #3
Not sure if I understand you correctly. The code is in String
module
and get loaded during runtime.
withanalogRead = require(name);
-
• #4
You just make sure that in your code you change
setInterval(() => {
tosetInterval(() => {"ram"
and when the module is loaded that function will be minified.But it won't be written to Storage as minified. If that really is your code, I'd consider maybe just not writing the module to storage at all, but just using
eval
to evaluate the string then and there to create the minified function in RAM -
• #5
Many thanks, minify to storage is not important. Wow never used
"ram"
before, sounds helpfull. Nice hint usingeval
will consider this too.
Some times you need code that is dependent on parameter. Like having one up to five analog reads depense on your device. Having it readable eats up lots of space.
Is there a way to minify Sting module?
output