>> Fred, I think I tried it correctly, but am not getting the private >> function in the constructor. What setting are you using? > > -js-output-type=FLEXJS > > class Main { > private function start():void { > // The code that will be called > }}
Is that because our call to start() is generated and jscomp only does compile time checking and does not insert any runtime checking logic that: <body> <script type="text/javascript"> new Main().start(); </script> </body> private function start():void { HtmlContainer.load([JQUERY_SCRIPT], run); } can be called ? Now, if I run the index.html from js-release in the browser, I got "Uncaught ReferenceError: Main is not defined" whatever start() is public or not. Frédéric THOMAS ---------------------------------------- > From: webdoubl...@hotmail.com > To: dev@flex.apache.org > Subject: RE: [FalconJX FlexJS] JQuery up and running, a nightmare but we now > have 1.9 in AS > Date: Sat, 27 Jun 2015 08:10:29 +0100 > >> Fred, I think I tried it correctly, but am not getting the private >> function in the constructor. What setting are you using? > > -js-output-type=FLEXJS > > class Main { > private function start():void { > // The code that will be called > }} > > Frédéric THOMAS > > > ---------------------------------------- >> From: aha...@adobe.com >> To: dev@flex.apache.org >> Subject: Re: [FalconJX FlexJS] JQuery up and running, a nightmare but we now >> have 1.9 in AS >> Date: Sat, 27 Jun 2015 06:29:28 +0000 >> >> Fred, I think I tried it correctly, but am not getting the private >> function in the constructor. What setting are you using? >> >> -Alex >> >> On 6/25/15, 8:02 AM, "Frédéric THOMAS" <webdoubl...@hotmail.com> wrote: >> >>>> Ah ok. That’s probably a bug. Not sure why, but the emitters currently >>>> initialize private members in the constructor. We discussed on some >>>>other >>>> thread a while back that this shouldn’t be necessary except for >>>>non-scalar >>>> initializers, so probably we should try to change this someday. >>> >>>Initializing methods in the constructor via myPrivateMethod = function() >>>{) will make it private but public instance methods not initialized in >>>the constructor won't be able to access it, public methods which aim to >>>access private methods need also to be declared in the contructor (eg. >>>"this.myPublicMethod = function() {return myPrivateMethod())") >>> >>>But do we need to replicate the AS3 NS behaviour in JS (public, private, >>>protected, custom NS) ? >>> >>>Has it been already discussed ? >>> >>>I'm not sure, my first answer would be no as the the developer will >>>develop in AS3 but if the code to be tested is the JS, I would answer >>>yes, we must reproduce what AS3 promises, the public, protected, private >>>and custom NS for classes and instances. >>> >>>Thoughts ? >>> >>>Frédéric THOMAS >>> >>> >>>---------------------------------------- >>>> From: aha...@adobe.com >>>> To: dev@flex.apache.org >>>> Subject: Re: [FalconJX FlexJS] JQuery up and running, a nightmare but >>>>we now have 1.9 in AS >>>> Date: Thu, 25 Jun 2015 14:37:30 +0000 >>>> >>>> Ah ok. That’s probably a bug. Not sure why, but the emitters currently >>>> initialize private members in the constructor. We discussed on some >>>>other >>>> thread a while back that this shouldn’t be necessary except for >>>>non-scalar >>>> initializers, so probably we should try to change this someday. >>>> >>>> -Alex >>>> >>>> On 6/25/15, 5:30 AM, "Frédéric THOMAS" <webdoubl...@hotmail.com> wrote: >>>> >>>>>>>That remains me, if I change my start() function to either public or >>>>>>>private, the cross compiled one is Main.prototype.start = function() >>>>>>>hence it becomes public, only the @public / @private annotation >>>>>>>changes, >>>>>>>is that expected ? >>>>>> >>>>>> I’m not sure I understand. What was it otherwise? >>>>> >>>>>Using inner construstor functions: >>>>> >>>>>-------------------------------------- >>>>>- Public function >>>>>-------------------------------------- >>>>> >>>>>public class Main { >>>>> public function start():void { >>>>> HtmlContainer.load([JQUERY_SCRIPT], run); >>>>> } >>>>>} >>>>> >>>>>/** >>>>> * @constructor >>>>> */ >>>>>Main = function() { >>>>> /** >>>>> * @public >>>>> */ >>>>> this.start = function() { >>>>> HtmlContainer.load([Main.JQUERY_SCRIPT], Main.run); >>>>> }; >>>>>}; >>>>> >>>>>-------------------------------------- >>>>>- Private function >>>>>-------------------------------------- >>>>> >>>>>public class Main { >>>>> private function start():void { >>>>> HtmlContainer.load([Main.JQUERY_SCRIPT], run); >>>>> } >>>>>} >>>>> >>>>> >>>>>/** >>>>> * @constructor >>>>> */ >>>>>Main = function() { >>>>> /** >>>>> * @private >>>>> */ >>>>> start = function() { >>>>> HtmlContainer.load([Main.JQUERY_SCRIPT], Main.run); >>>>> }; >>>>>}; >>>>> >>>>> >>>>>Frédéric THOMAS >>>>> >>>>> >>>>>---------------------------------------- >>>>>> From: aha...@adobe.com >>>>>> To: dev@flex.apache.org >>>>>> Subject: Re: [FalconJX FlexJS] JQuery up and running, a nightmare but >>>>>>we now have 1.9 in AS >>>>>> Date: Thu, 25 Jun 2015 04:57:48 +0000 >>>>>> >>>>>> >>>>>> >>>>>> On 6/24/15, 6:43 PM, "Frédéric THOMAS" <webdoubl...@hotmail.com> >>>>>>wrote: >>>>>> >>>>>>>> When we wrote js we were not sure of naming conventions. Google >>>>>>>seems to like backing variables to end with dash but flex starts with >>>>>>>dash. Not sure what to do. I'm thinking we change to end with dash. >>>>>>> >>>>>>>Even though those 2 properties are public ? >>>>>> >>>>>> Sorry, I took a closer look. There shouldn’t be _ on those properties. >>>>>> Keep in mind that there has been relatively little testing on this >>>>>>code. >>>>>> We get the examples to work and call it “done for now”. >>>>>> >>>>>>> >>>>>>>That remains me, if I change my start() function to either public or >>>>>>>private, the cross compiled one is Main.prototype.start = function() >>>>>>>hence it becomes public, only the @public / @private annotation >>>>>>>changes, >>>>>>>is that expected ? >>>>>> >>>>>> I’m not sure I understand. What was it otherwise? >>>>>> >>>>>> -Alex >>>>>> >>>>> >>>> >>> >> >