• The if (C) {...}-thing still gives me annoying grieve,... I thought the added curly braces would have solved the issue for good...

     1v70 Copyright 2014 G.Williams
    >echo(0);
    Uncaught Error: FOR loop can only iterate over Arrays, Strings or Objects, not undefined
     at line 1 col 288
    ...or(var v in C)this.C[v]=C[v]}
                                   ^
    

    Related to this code (line 10 in constructor), coming from the (again) working space-only-minified sandbox modules folder. (Had to re-enable some minification option after getting unexplicable out of memory error - see http://forum.espruino.com/comments/11900­960/).

    // ACD pins for X-, X+, Y-, Y+, optional - but one - callbacks, optional C(onfig) 
    function TOUCHR(xn,xp,yn,yp,onDownCB,onTrackCB,on­UpCB,onEscCB,C) {
      this.xn = xn; this.xp = xp; this.yn = yn; this.yp = yp;
      this.cbs = [[onDownCB,onTrackCB,onUpCB,onEscCB]]; 
      this.w = null; this.te = 0; this.upCnt = 0; this.up = true;
      this.xr = this.xrr = this.yr = this.yrr = -1;
      this.x = this.x0 = this.x1 = -1;
      this.y = this.y0 = this.y1 = -1;
      this.t = this.t0 = this.t1 =  0;
      if (C) { for (var v in C) { this.C[v] = C[v]; } }
    }
    

    The constructor is invoked with undefined for C.

    The minification messes with the code to the point where the execution and block nesting becomes broken... Why would I say so: Adding/removing some code further down in the module made the error flip-flop...

    Interestingly, when I put a console.log() in the if-(then) block, it 'tricks' the minification and - miraculously (for me) - works:

      if (C) { console.log("C:",C); for (var v in C) { this.C[v] = C[v]; } }
    

    @Gordon, since you know your code like your own pockets, I'm sure you have a nice explanation - and may be - even a remedy top of your head... ;-)

    The stuff seems to be related to what @DaveNI experienced in Minified Code Producing Error - Solved at http://forum.espruino.com/conversations/­257029/

About

Avatar for allObjects @allObjects started