facebook

How to redeclare a global variable visible only within the module for many file?

  1. CodeMix & Angular IDE
  2.  > 
  3. Webclipse 1.x Help
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #511627 Reply

    gorand
    Participant

    Hellow!

    How to override the global variable inside the module so that the files in druih where this module is indicated variable was redefined?
    See attached images

    Attachments:
    You must be logged in to view attached files.
    #512181 Reply

    gorand
    Participant

    I independently found a partial solution to the problem soy:
    this new module in each unit each time to declare

    
    module pkgProba1 {
    	export class Test1 {
    		i1:number;
    	}
    	export class Proba1 {
    		Test:Test1;
    	}
    }
    declare var mvar:pkgProba1.Proba1;
    function test() { mvar.Test=null; }
    
    module pkgProba2 {
    	export class Test2 extends pkgProba1.Test1 {
    		i2:number;
    	}
    	export class Proba1 {
    		Test:Test2;
    	}
    	export class TestVar1 {
    		test() { mvar.Test=null; }
    	}
    	declare var mvar:Proba1;
    }
    
    module pkgProba2 {
    	declare var mvar:Proba1;
    	export class TestVar2 {
    		test() { }
    	}
    }
    
    module pkgProba2 {
    	declare var mvar:Proba1;
    	export class TestVar3 {
    		test() { mvar.Test=null; }
    	}
    }
    
    • This reply was modified 7 years, 9 months ago by gorand. Reason: modify code
    • This reply was modified 7 years, 9 months ago by gorand.
    Attachments:
    You must be logged in to view attached files.
    #512187 Reply

    support-piotr
    Participant

    Hi Gorand,

    Sorry for not reaching out to you earlier. It looks like you would have to export “mvar” to be visible between different module blocks, but than you loose on separation. Redeclaring var in each module seems to be the best middle ground indeed.

    Best regards,
    Piotr Tomiak

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: How to redeclare a global variable visible only within the module for many file?

You must be logged in to post in the forum log in