Avatar for Nadnerb

Nadnerb

Member since Nov 2018 • Last active Mar 2019
  • 3 conversations
  • 13 comments

Most recent activity

  • in General
    Avatar for Nadnerb

    I'm currently using the "JS & CSS Minifier" extension on VSCode. It works excellently, minimizes to ES6 and I've had no issues so far.
    https://github.com/olback/es6-css-minify­

    Thanks for clarifying how the modules as functions behaves, that makes sense to me now.

  • in General
    Avatar for Nadnerb

    I just tested it with minification off and that seems to be correct. with all minification off it works. (with or without modules as functions enabled).

    I would rather not share the code I'm uploading, aside from being over 2000 lines, it will be used for a proof of concept and includes some proprietary information that I'd have to remove before uploading. Sorry. I know its easier to help when you have the full code.

    As for the minification settings: Its working fine using "Simple Optimizations", as long as "modules as functions" is not checked.
    If it is checked then I need to use "No minification".
    Using "Simple optimizations" or "Whitespace Only" results in the $jscomp error above.

    But I'm not using the functionality from "modules as functions", so it can remain unchecked for my project.

    So it seems that $jscomp is inserted when transpiling ES6 -> ES5.
    That makes sense because I am using ES6 code, making use of the arrow notation which seems to be transpiled to ES5 in the Closure Compiler.

    Just as an experiment, I have used an ES6 aware minifier, which doesn't transpile the arrow notations. This has worked and has produced code smaller than the closure compiler minifier. (4900 vs 4600 bytes).

  • in General
    Avatar for Nadnerb

    I figured out the issue.
    Modules as functions cant be ticked. If its unticked it works fine, if it doesnt, then it comes up with an error regarding $jscomp.initSymbol or $jscomp.makeIterator.

    If I use closure compiler to minify my code, these variables are not part of the code, which confused me, but when I did a dump() I could see that these variables were in the code that was uploaded, and were causing problems. Since unchecking the modules as functions box its stopped producing the error and allows my code to execute.

    According to the webIDE this function is still in BETA, so I'm not sure if this feedback will be useful in order to fix it for upcoming releases.

  • in General
    Avatar for Nadnerb

    The same thing:

    Uncaught ReferenceError: "$jscomp" is not defined
     at line 1 col 150
    ...(var $jscomp$iter$0=$jscomp.makeIterator(data­),$jscomp$key$x...
                                  ^
    in function called from system
    

    But when I use it as code inside the build - as in I've rebuilt the .hex firmware file including the module in source code, it works.

  • in General
    Avatar for Nadnerb

    I am actually using the name without the file extension, sorry about writing it wrong in my post. [edited now]
    Even if that was the problem, it would give me an error saying it failed to load it. This loads it but then crashes on execution.

    I also run it without minification until I'm done w/development. I was developing this particular module months ago in the sandbox, and thought I was done and minified it and added it to the build. (the file in question is a board file, specifying the lower level AT commands of a custom board).

    However, I need to update the file, so I am going back to tweak it, but the sandbox version no longer works because of some error. Even without the minification, I'm still getting an error which looks similar to what closure compiler would give. (I've noticed $jscomp is a variable in the closure compiler, so I shouldn't expect to see this if my code isn't minified.)

  • in General
    Avatar for Nadnerb

    Not sure if you can help, but I get an error running a custom js module from the sandbox/modules folder and I've been scratching my head for hours working out why. Particularly when it worked using a previous version of Espruino.

    I'm using a

    require('testingModule')
    

    command to load the testingModule.js file and it loads fine, however when it executes a function in that module I get the following error:

    With module minification on:

    Uncaught Error: Function "initSymbol" not found! at line 1 col 3
    m.initSymbol();m.initSymbol();m.initSymb­olIterator();m.initS...
    in function "makeIterator" called from line 1 col 105 ...var
    d="",k=m.makeIterator(e),f=k.next();!f.d­one;f=k.next())d...

    With module minification off:

    Uncaught ReferenceError: "$jscomp" is not defined at line 1 col 150
    ...(var $jscomp$iter$0=$jscomp.makeIterator(data­),$jscomp$key$x...
    in function called from system

    The function uses an AT command to connect the module to the server using TCP.

    I know there are no issues with the function, because when I include it in the build (/libs/js), it works and executes that function without any errors.

    What is really odd is that there is no "initSymbol", "makeIterator" or "$jscomp" inside my code at all. Not in this module or any other application code that I've written.

    This same sandbox functionality was working when I was using an older version of Espruino.

  • in Other Boards
    Avatar for Nadnerb

    Hi Gordon,
    We made our own QuectelBC95.js file, because our device uses a BC95-G module.

    The low level code that we've written in this file is what is causing issues, specifically in the receive handler. So its nothing with Espruino that is the issue. I have figured out a solution now, by using the "+NSONMI" receive handler to output the number of bytes received and then retrieve them at a later time using "AT+NSORF", rather than retrieve them in the receive handler itself.

    Thanks for your help.

  • in Other Boards
    Avatar for Nadnerb

    I turned on debug statements in the lower level code (QuectelBC95.js) and there seems to be an issue there. I'll take a look at that instead.

Actions