robbe's Forum Posts

  • 3 posts
  • Problem Description

    c2runtime.js creates a lot of global variables.

    For example: the first line of c2runtime starts with:

    'use strict';var aa,ba,ca,ea,y,fa,ga,ha,B,ja,ka,ma,na,oa,pa,C,qa,ra,N,ua,xa,ya,Aa,R,T,Ba,Ca,Da,Ea,U,Fa,Ga,V,Ha,Ia,Ja,Ka,La,Ma,Na,Oa,Pa,Qa,Ra,Sa,Ta,Ua,Va,Wa,Xa,Ya,Za,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb,Ab,Bb,Cb,Db,Eb,Fb,Gb,Hb,Ib,Jb,Kb,Lb,Mb,Nb,Ob,Pb,Qb,Rb,Sb,X,Tb,Ub={}[/code:l7xjvx7p]
    
    This is not a problem per se, but because these var names are minified we cannot use third party libraries safely. In our case some of these vars were overlapping with google tag manager code. (I spent the whole day locating the problem, never thought construct export would be this dirty   ).
    
    I know it's more of a "best practice" thing than a bug, but it will remain a critical issue in some cases.
    
    [b]Attach a Capx[/b]
    N/A
        
    [b]Description of Capx[/b]
    N/A
    
    [b]Steps to Reproduce Bug[/b]
    [ul]
        [li] Step 1: make construct project
        [/li][li] Step 2: export construct project[/li][/ul]
        
    [b]Observed Result[/b]
    c2runtime pollutes global namespace
        
    [b]Expected Result[/b]
    c2runtime should not pollute global namespace
    
    And how to fix:
    Add [code:l7xjvx7p](function(){[/code:l7xjvx7p] at the beginning and [code:l7xjvx7p]})();[/code:l7xjvx7p] at the end of the script file. [i]Magic[/i]
    
    (This is my temp fix at least. If there is another way to fix this, so I don't have to fiddle with every export, I'll be glad to hear it.)
    
    [b]Affected Browsers[/b]
    [ul]
        [li] Chrome: YES
        [/li][li] FireFox: YES
        [/li][li] Internet Explorer: YES[/li][/ul]
        
    [b]Operating System and Service Pack[/b]
    windows 8
        
    [b]Construct 2 Version ID[/b]
    r221
    
    [b]PS:[/b] thanks in advance
  • Hi, thanks for this tutorial, wasn't quite what I needed but it comes close.

    I have several projects with the same menu/ui, so I've put all menu and UI event in seperate sheets. According to this tutorial I can safely copy event sheet XML files from one project to the other. I've been doing it for some time now and haven't noticed anything strange, but you never know.

    The thing I am a little worried about is those

    sid="1369915436515779"[/code:zioofcj8] attributes. Are these used for anything specific and can they cause conflicts of some kind?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just a quick thought:

    You could try loading the array from json (you can use the array action load with otherArray.AsJSON expression).

  • 3 posts