Re: Problems to create AS3 externs when JS library returns some kind of object
t; >> > > > > wrote: >> > > > > >> > > > > > Hi Josh, >> > > > > > >> > > > > > so if I understand correctly your words, for cases where the >> > function >> > > > is >> > > > > > called the same as the typedef and we have params and return >> values >> > > we >> > > > > need >> > > > > > to create a function as I did and then add the rest of >> functions in >> > > > > > separate files in the packaged named the same as the typedef? >> > > > > > >> > > > > > Regarding "marked" example, I got the initial example working, >> but >> > > I'm >> > > > > > trying to configure options that require create internal types >> in >> > > > marked, >> > > > > > and I'm not got it already. >> > > > > > >> > > > > > thanks >> > > > > > >> > > > > > >> > > > > > >> > > > > > El mié., 15 abr. 2020 a las 18:00, Josh Tynjala (< >> > > > > > joshtynj...@bowlerhat.dev>) >> > > > > > escribió: >> > > > > > >> > > > > > > It's not ideal, but one way that I've found to define a >> typedef >> > > > > function >> > > > > > > that exposes "static" functions similar to a class is to put >> > those >> > > > > > "static" >> > > > > > > functions into a package with the same name as the root >> function. >> > > > > > > >> > > > > > > package >> > > > > > > { >> > > > > > > /** >> > > > > > > * @externs >> > > > > > > */ >> > > > > > > COMPILE::JS >> > > > > > > public function marked(s:String):String { >> > > > > > > return null; >> > > > > > > }; >> > > > > > > } >> > > > > > > >> > > > > > > package marked >> > > > > > > { >> > > > > > > /** >> > > > > > > * @externs >> > > > > > > * configure marked with options >> > > > > > > */ >> > > > > > > COMPILE::JS >> > > > > > > public function setOptions(o:Object):void {}; >> > > > > > > } >> > > > > > > >> > > > > > > Another option is to use dynamic access, but that won't be >> > checked >> > > by >> > > > > the >> > > > > > > compiler. >> > > > > > > >> > > > > > > marked["setOptions"]() >> > > > > > > >> > > > > > > -- >> > > > > > > Josh Tynjala >> > > > > > > Bowler Hat LLC <https://bowlerhat.dev> >> > > > > > > >> > > > > > > >> > > > > > > On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira < >> > > > carlosrov...@apache.org >> > > > > > >> > > > > > > wrote: >> > > > > > > >> > > > > > > > Hi Yishay, >> > > > > > > > >> > > > > > > > this finally worked (declaring as a function): >> > > > > > > > >> > > > > > > > package >> > > > > > > > { >> > > > > > > > /** >> > > > > > > > * @externs >> > > > > > > > */ >> > > > > > > > COMPILE::JS >> > > > > > > > public function marked(s:String):String { >> > > > > > > > return null; >> > > > > > > > }; >> > > > > > > > } >> > > > > > > > >> > > > > > > > I see two problems with this approach >> > > > > > > > >> > > > > > > >1. inject_html is not valid, So I need other wrapper >> class >> > to >> > > > add >> > > > >
Re: Problems to create AS3 externs when JS library returns some kind of object
gt; > > > > > package > > > > > > > { > > > > > > > /** > > > > > > > * @externs > > > > > > > */ > > > > > > > COMPILE::JS > > > > > > > public function marked(s:String):String { > > > > > > > return null; > > > > > > > }; > > > > > > > } > > > > > > > > > > > > > > package marked > > > > > > > { > > > > > > > /** > > > > > > > * @externs > > > > > > > * configure marked with options > > > > > > > */ > > > > > > > COMPILE::JS > > > > > > > public function setOptions(o:Object):void {}; > > > > > > > } > > > > > > > > > > > > > > Another option is to use dynamic access, but that won't be > > checked > > > by > > > > > the > > > > > > > compiler. > > > > > > > > > > > > > > marked["setOptions"]() > > > > > > > > > > > > > > -- > > > > > > > Josh Tynjala > > > > > > > Bowler Hat LLC <https://bowlerhat.dev> > > > > > > > > > > > > > > > > > > > > > On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira < > > > > carlosrov...@apache.org > > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > Hi Yishay, > > > > > > > > > > > > > > > > this finally worked (declaring as a function): > > > > > > > > > > > > > > > > package > > > > > > > > { > > > > > > > > /** > > > > > > > > * @externs > > > > > > > > */ > > > > > > > > COMPILE::JS > > > > > > > > public function marked(s:String):String { > > > > > > > > return null; > > > > > > > > }; > > > > > > > > } > > > > > > > > > > > > > > > > I see two problems with this approach > > > > > > > > > > > > > > > >1. inject_html is not valid, So I need other wrapper > class > > to > > > > add > > > > > > the > > > > > > > >inject_html and use marked within, to make usable as a > piece > > > of > > > > > code > > > > > > > > (don't > > > > > > > >like let the user to add the .js script to the html > template > > > > > > > >2. Since is a function I can add other API functions like > > > > > > setOptions. > > > > > > > > ie: > > > > > > > > > > > > > > > > /** > > > > > > > > * configure marked with options > > > > > > > > */ > > > > > > > > COMPILE::JS > > > > > > > > public function setOptions(o:Object):void {}; > > > > > > > > > > > > > > > > Would like to be know how to declare this as a class to add > > other > > > > > > > function > > > > > > > > APIs available in the js library > > > > > > > > > > > > > > > > > > > > > > > > El mié., 15 abr. 2020 a las 11:14, Yishay Weiss (< > > > > > > yishayj...@hotmail.com > > > > > > > >) > > > > > > > > escribió: > > > > > > > > > > > > > > > > > You can just return null. > > > > > > > > > > > > > > > > > > I think the best thing for you to do is to go to one of the > > > > > typedefs, > > > > > > > > > build, and look at the generated sources. > > > > > > > > > > > > > > > > > > For example > > > > > > > > > > > > > > > > > > cd …\royale-typedefs > > > > > > > > > cd google_maps > > > > > > > > > ant; > > > > > > > > > cd target\generated-sources > > > > > > > > > > > > > > > > > > Explore the .as classes there. > > > > > > > > > > > > > > > > > > Hope this helps. > > > > > > > > > > > > > > > > > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > > > > > > > > > Sent: Wednesday, April 15, 2020 12:05 PM > > > > > > > > > To: Apache Royale Development<mailto:dev@royale.apache.org > > > > > > > > > > > Subject: Re: Problems to create AS3 externs when JS library > > > > returns > > > > > > > some > > > > > > > > > kind of object > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > > additional to this, is how we can create an extern function > > > that > > > > > > return > > > > > > > > > something: > > > > > > > > > > > > > > > > > > public function someFoo(s:String):String {}; > > > > > > > > > > > > > > > > > > AS3 expect here some return value inside the brackets. So > how > > > we > > > > > can > > > > > > > > write > > > > > > > > > this in AS3 without errors? > > > > > > > > > > > > > > > > > > thanks > > > > > > > > > > > > > > > > > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira (< > > > > > > > > carlosrov...@apache.org > > > > > > > > > >) > > > > > > > > > escribió: > > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > I'm playing with a js markdown library [1] to see if is > an > > > > option > > > > > > to > > > > > > > > make > > > > > > > > > > a Royale website that load markdown and render it (I'm > > > > > > experimenting > > > > > > > to > > > > > > > > > see > > > > > > > > > > if we can't remove wordpress from our website and make a > > web > > > > > based > > > > > > on > > > > > > > > > > markdown similar to royale-docs) > > > > > > > > > > > > > > > > > > > > I'm having problems trying to create the extern as3 file. > > I'm > > > > > > trying > > > > > > > > > > something similar to what we did with hljs. Here's my > try: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > package > > > > > > > > > > { > > > > > > > > > > /** > > > > > > > > > > * marked js library > > > > > > > > > > */ > > > > > > > > > > COMPILE::JS > > > > > > > > > > public class marked > > > > > > > > > > { > > > > > > > > > > /** > > > > > > > > > > * > > > > > > > > > > * > > > > > > > > > > * https://cdn.jsdelivr.net/npm/marked/marked.min.js</a> > > > > > > > > > > "> > > > > > > > > > > * > > > > > > > > > > * > > > > > > > > > > * @royaleignorecoercion String > > > > > > > > > > */ > > > > > > > > > > public function marked(s:String):String {}; > > > > > > > > > > > > > > > > > > > > /** > > > > > > > > > > * configure marked with options > > > > > > > > > > */ > > > > > > > > > > public function setOptions(o:Object):void {}; > > > > > > > > > > } > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > The problem is > > > > > > > > > > > > > > > > > > > > public function marked(s:String):String {}; > > > > > > > > > > > > > > > > > > > > since the library gets a String and returns a String, but > > AS3 > > > > > > > > > constructors > > > > > > > > > > must be void > > > > > > > > > > > > > > > > > > > > I remember Josh posted alternative ways to create this > kind > > > of > > > > > AS3 > > > > > > > > stubs, > > > > > > > > > > but he posted in a paste apache that is now gone. > > > > > > > > > > Anyway would be good to know if this is a limitation of > AS3 > > > > > > language > > > > > > > > and > > > > > > > > > > we can't create this kind of AS3 classes that model a JS > > > > library > > > > > > with > > > > > > > > > > constructors that return something like a string. > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > [1] https://marked.js.org/#/README.md#usage > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Carlos Rovira > > > > > > > > > > http://about.me/carlosrovira > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > Carlos Rovira > > > > > > > > > http://about.me/carlosrovira > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > Carlos Rovira > > > > > > > > http://about.me/carlosrovira > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Carlos Rovira > > > > > > http://about.me/carlosrovira > > > > > > > > > > > > > > > > > > > > > > > -- > > > > Carlos Rovira > > > > http://about.me/carlosrovira > > > > > > > > > > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > > -- Carlos Rovira http://about.me/carlosrovira
Re: Problems to create AS3 externs when JS library returns some kind of object
language : > > > 'plaintext'; > > > return hljs.highlight(validLanguage, code).value; > > > }, > > > pedantic: false, > > > gfm: true, > > > breaks: false, > > > sanitize: false, > > > smartLists: true, > > > smartypants: false, > > > xhtml: false > > > }); > > > > > > // Compile > > > console.log(marked(markdownString)); > > > > > > > > > I was thinking in use it in the basic way, but soon I'll need to use > the > > > highlight since our web uses code that needs to be highlighted. > > > > > > Anyway, just exposing the issue here. I'm going to try other markdown > lib > > > (although seems this is the most used) that has other API surface more > > > compatible with Royale until someone can take a look and see how we can > > > make this work on Royale. > > > > > > Thanks > > > > > > > > > > > > El mié., 15 abr. 2020 a las 20:54, Josh Tynjala (< > > > joshtynj...@bowlerhat.dev>) > > > escribió: > > > > > > > Yes, it sounds like you have understood me correctly. > > > > > > > > -- > > > > Josh Tynjala > > > > Bowler Hat LLC <https://bowlerhat.dev> > > > > > > > > > > > > On Wed, Apr 15, 2020 at 11:00 AM Carlos Rovira < > > carlosrov...@apache.org> > > > > wrote: > > > > > > > > > Hi Josh, > > > > > > > > > > so if I understand correctly your words, for cases where the > function > > > is > > > > > called the same as the typedef and we have params and return values > > we > > > > need > > > > > to create a function as I did and then add the rest of functions in > > > > > separate files in the packaged named the same as the typedef? > > > > > > > > > > Regarding "marked" example, I got the initial example working, but > > I'm > > > > > trying to configure options that require create internal types in > > > marked, > > > > > and I'm not got it already. > > > > > > > > > > thanks > > > > > > > > > > > > > > > > > > > > El mié., 15 abr. 2020 a las 18:00, Josh Tynjala (< > > > > > joshtynj...@bowlerhat.dev>) > > > > > escribió: > > > > > > > > > > > It's not ideal, but one way that I've found to define a typedef > > > > function > > > > > > that exposes "static" functions similar to a class is to put > those > > > > > "static" > > > > > > functions into a package with the same name as the root function. > > > > > > > > > > > > package > > > > > > { > > > > > > /** > > > > > > * @externs > > > > > > */ > > > > > > COMPILE::JS > > > > > > public function marked(s:String):String { > > > > > > return null; > > > > > > }; > > > > > > } > > > > > > > > > > > > package marked > > > > > > { > > > > > > /** > > > > > > * @externs > > > > > > * configure marked with options > > > > > > */ > > > > > > COMPILE::JS > > > > > > public function setOptions(o:Object):void {}; > > > > > > } > > > > > > > > > > > > Another option is to use dynamic access, but that won't be > checked > > by > > > > the > > > > > > compiler. > > > > > > > > > > > > marked["setOptions"]() > > > > > > > > > > > > -- > > > > > > Josh Tynjala > > > > > > Bowler Hat LLC <https://bowlerhat.dev> > > > > > > > > > > > > > > > > > > On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira < > > > carlosrov...@apache.org > > > > > > > > > > > wrote: > > > > > > > > > > > > > Hi Yishay, > > > > > > > > > > > > > > this finally worked (declaring as a function): > > > > > > > > > > > > > >
Re: Problems to create AS3 externs when JS library returns some kind of object
> > Yes, it sounds like you have understood me correctly. > > > > > > -- > > > Josh Tynjala > > > Bowler Hat LLC <https://bowlerhat.dev> > > > > > > > > > On Wed, Apr 15, 2020 at 11:00 AM Carlos Rovira < > carlosrov...@apache.org> > > > wrote: > > > > > > > Hi Josh, > > > > > > > > so if I understand correctly your words, for cases where the function > > is > > > > called the same as the typedef and we have params and return values > we > > > need > > > > to create a function as I did and then add the rest of functions in > > > > separate files in the packaged named the same as the typedef? > > > > > > > > Regarding "marked" example, I got the initial example working, but > I'm > > > > trying to configure options that require create internal types in > > marked, > > > > and I'm not got it already. > > > > > > > > thanks > > > > > > > > > > > > > > > > El mié., 15 abr. 2020 a las 18:00, Josh Tynjala (< > > > > joshtynj...@bowlerhat.dev>) > > > > escribió: > > > > > > > > > It's not ideal, but one way that I've found to define a typedef > > > function > > > > > that exposes "static" functions similar to a class is to put those > > > > "static" > > > > > functions into a package with the same name as the root function. > > > > > > > > > > package > > > > > { > > > > > /** > > > > > * @externs > > > > > */ > > > > > COMPILE::JS > > > > > public function marked(s:String):String { > > > > > return null; > > > > > }; > > > > > } > > > > > > > > > > package marked > > > > > { > > > > > /** > > > > > * @externs > > > > > * configure marked with options > > > > > */ > > > > > COMPILE::JS > > > > > public function setOptions(o:Object):void {}; > > > > > } > > > > > > > > > > Another option is to use dynamic access, but that won't be checked > by > > > the > > > > > compiler. > > > > > > > > > > marked["setOptions"]() > > > > > > > > > > -- > > > > > Josh Tynjala > > > > > Bowler Hat LLC <https://bowlerhat.dev> > > > > > > > > > > > > > > > On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira < > > carlosrov...@apache.org > > > > > > > > > wrote: > > > > > > > > > > > Hi Yishay, > > > > > > > > > > > > this finally worked (declaring as a function): > > > > > > > > > > > > package > > > > > > { > > > > > > /** > > > > > > * @externs > > > > > > */ > > > > > > COMPILE::JS > > > > > > public function marked(s:String):String { > > > > > > return null; > > > > > > }; > > > > > > } > > > > > > > > > > > > I see two problems with this approach > > > > > > > > > > > >1. inject_html is not valid, So I need other wrapper class to > > add > > > > the > > > > > >inject_html and use marked within, to make usable as a piece > of > > > code > > > > > > (don't > > > > > >like let the user to add the .js script to the html template > > > > > >2. Since is a function I can add other API functions like > > > > setOptions. > > > > > > ie: > > > > > > > > > > > > /** > > > > > > * configure marked with options > > > > > > */ > > > > > > COMPILE::JS > > > > > > public function setOptions(o:Object):void {}; > > > > > > > > > > > > Would like to be know how to declare this as a class to add other > > > > > function > > > > > > APIs available in the js library > > > > > > > > > > > > > > > > > > El mié.
Re: Problems to create AS3 externs when JS library returns some kind of object
> > > > */ > > > > COMPILE::JS > > > > public function marked(s:String):String { > > > > return null; > > > > }; > > > > } > > > > > > > > package marked > > > > { > > > > /** > > > > * @externs > > > > * configure marked with options > > > > */ > > > > COMPILE::JS > > > > public function setOptions(o:Object):void {}; > > > > } > > > > > > > > Another option is to use dynamic access, but that won't be checked by > > the > > > > compiler. > > > > > > > > marked["setOptions"]() > > > > > > > > -- > > > > Josh Tynjala > > > > Bowler Hat LLC <https://bowlerhat.dev> > > > > > > > > > > > > On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira < > carlosrov...@apache.org > > > > > > > wrote: > > > > > > > > > Hi Yishay, > > > > > > > > > > this finally worked (declaring as a function): > > > > > > > > > > package > > > > > { > > > > > /** > > > > > * @externs > > > > > */ > > > > > COMPILE::JS > > > > > public function marked(s:String):String { > > > > > return null; > > > > > }; > > > > > } > > > > > > > > > > I see two problems with this approach > > > > > > > > > >1. inject_html is not valid, So I need other wrapper class to > add > > > the > > > > > inject_html and use marked within, to make usable as a piece of > > code > > > > > (don't > > > > >like let the user to add the .js script to the html template > > > > >2. Since is a function I can add other API functions like > > > setOptions. > > > > > ie: > > > > > > > > > > /** > > > > > * configure marked with options > > > > > */ > > > > > COMPILE::JS > > > > > public function setOptions(o:Object):void {}; > > > > > > > > > > Would like to be know how to declare this as a class to add other > > > > function > > > > > APIs available in the js library > > > > > > > > > > > > > > > El mié., 15 abr. 2020 a las 11:14, Yishay Weiss (< > > > yishayj...@hotmail.com > > > > >) > > > > > escribió: > > > > > > > > > > > You can just return null. > > > > > > > > > > > > I think the best thing for you to do is to go to one of the > > typedefs, > > > > > > build, and look at the generated sources. > > > > > > > > > > > > For example > > > > > > > > > > > > cd …\royale-typedefs > > > > > > cd google_maps > > > > > > ant; > > > > > > cd target\generated-sources > > > > > > > > > > > > Explore the .as classes there. > > > > > > > > > > > > Hope this helps. > > > > > > > > > > > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > > > > > > Sent: Wednesday, April 15, 2020 12:05 PM > > > > > > To: Apache Royale Development<mailto:dev@royale.apache.org> > > > > > > Subject: Re: Problems to create AS3 externs when JS library > returns > > > > some > > > > > > kind of object > > > > > > > > > > > > Hi, > > > > > > > > > > > > additional to this, is how we can create an extern function that > > > return > > > > > > something: > > > > > > > > > > > > public function someFoo(s:String):String {}; > > > > > > > > > > > > AS3 expect here some return value inside the brackets. So how we > > can > > > > > write > > > > > > this in AS3 without errors? > > > > > > > > > > > > thanks > > > > > > > > > > > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira (< > > > > > carlosrov...@apache.org > > > > > > >) > > > > > > escribió: > > >
Re: Problems to create AS3 externs when JS library returns some kind of object
; > > > > I see two problems with this approach > > > > > > > >1. inject_html is not valid, So I need other wrapper class to add > > the > > > >inject_html and use marked within, to make usable as a piece of > code > > > > (don't > > > >like let the user to add the .js script to the html template > > > >2. Since is a function I can add other API functions like > > setOptions. > > > > ie: > > > > > > > > /** > > > > * configure marked with options > > > > */ > > > > COMPILE::JS > > > > public function setOptions(o:Object):void {}; > > > > > > > > Would like to be know how to declare this as a class to add other > > > function > > > > APIs available in the js library > > > > > > > > > > > > El mié., 15 abr. 2020 a las 11:14, Yishay Weiss (< > > yishayj...@hotmail.com > > > >) > > > > escribió: > > > > > > > > > You can just return null. > > > > > > > > > > I think the best thing for you to do is to go to one of the > typedefs, > > > > > build, and look at the generated sources. > > > > > > > > > > For example > > > > > > > > > > cd …\royale-typedefs > > > > > cd google_maps > > > > > ant; > > > > > cd target\generated-sources > > > > > > > > > > Explore the .as classes there. > > > > > > > > > > Hope this helps. > > > > > > > > > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > > > > > Sent: Wednesday, April 15, 2020 12:05 PM > > > > > To: Apache Royale Development<mailto:dev@royale.apache.org> > > > > > Subject: Re: Problems to create AS3 externs when JS library returns > > > some > > > > > kind of object > > > > > > > > > > Hi, > > > > > > > > > > additional to this, is how we can create an extern function that > > return > > > > > something: > > > > > > > > > > public function someFoo(s:String):String {}; > > > > > > > > > > AS3 expect here some return value inside the brackets. So how we > can > > > > write > > > > > this in AS3 without errors? > > > > > > > > > > thanks > > > > > > > > > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira (< > > > > carlosrov...@apache.org > > > > > >) > > > > > escribió: > > > > > > > > > > > Hi, > > > > > > > > > > > > I'm playing with a js markdown library [1] to see if is an option > > to > > > > make > > > > > > a Royale website that load markdown and render it (I'm > > experimenting > > > to > > > > > see > > > > > > if we can't remove wordpress from our website and make a web > based > > on > > > > > > markdown similar to royale-docs) > > > > > > > > > > > > I'm having problems trying to create the extern as3 file. I'm > > trying > > > > > > something similar to what we did with hljs. Here's my try: > > > > > > > > > > > > > > > > > > package > > > > > > { > > > > > > /** > > > > > > * marked js library > > > > > > */ > > > > > > COMPILE::JS > > > > > > public class marked > > > > > > { > > > > > > /** > > > > > > * > > > > > > * > > > > > > * https://cdn.jsdelivr.net/npm/marked/marked.min.js</a> > > > > > > "> > > > > > > * > > > > > > * > > > > > > * @royaleignorecoercion String > > > > > > */ > > > > > > public function marked(s:String):String {}; > > > > > > > > > > > > /** > > > > > > * configure marked with options > > > > > > */ > > > > > > public function setOptions(o:Object):void {}; > > > > > > } > > > > > > } > > > > > > > > > > > > The problem is > > > > > > > > > > > > public function marked(s:String):String {}; > > > > > > > > > > > > since the library gets a String and returns a String, but AS3 > > > > > constructors > > > > > > must be void > > > > > > > > > > > > I remember Josh posted alternative ways to create this kind of > AS3 > > > > stubs, > > > > > > but he posted in a paste apache that is now gone. > > > > > > Anyway would be good to know if this is a limitation of AS3 > > language > > > > and > > > > > > we can't create this kind of AS3 classes that model a JS library > > with > > > > > > constructors that return something like a string. > > > > > > > > > > > > Thanks > > > > > > > > > > > > [1] https://marked.js.org/#/README.md#usage > > > > > > > > > > > > -- > > > > > > Carlos Rovira > > > > > > http://about.me/carlosrovira > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Carlos Rovira > > > > > http://about.me/carlosrovira > > > > > > > > > > > > > > > > > > -- > > > > Carlos Rovira > > > > http://about.me/carlosrovira > > > > > > > > > > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > > -- Carlos Rovira http://about.me/carlosrovira
Re: Problems to create AS3 externs when JS library returns some kind of object
Yes, it sounds like you have understood me correctly. -- Josh Tynjala Bowler Hat LLC <https://bowlerhat.dev> On Wed, Apr 15, 2020 at 11:00 AM Carlos Rovira wrote: > Hi Josh, > > so if I understand correctly your words, for cases where the function is > called the same as the typedef and we have params and return values we need > to create a function as I did and then add the rest of functions in > separate files in the packaged named the same as the typedef? > > Regarding "marked" example, I got the initial example working, but I'm > trying to configure options that require create internal types in marked, > and I'm not got it already. > > thanks > > > > El mié., 15 abr. 2020 a las 18:00, Josh Tynjala (< > joshtynj...@bowlerhat.dev>) > escribió: > > > It's not ideal, but one way that I've found to define a typedef function > > that exposes "static" functions similar to a class is to put those > "static" > > functions into a package with the same name as the root function. > > > > package > > { > > /** > > * @externs > > */ > > COMPILE::JS > > public function marked(s:String):String { > > return null; > > }; > > } > > > > package marked > > { > > /** > > * @externs > > * configure marked with options > > */ > > COMPILE::JS > > public function setOptions(o:Object):void {}; > > } > > > > Another option is to use dynamic access, but that won't be checked by the > > compiler. > > > > marked["setOptions"]() > > > > -- > > Josh Tynjala > > Bowler Hat LLC <https://bowlerhat.dev> > > > > > > On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira > > wrote: > > > > > Hi Yishay, > > > > > > this finally worked (declaring as a function): > > > > > > package > > > { > > > /** > > > * @externs > > > */ > > > COMPILE::JS > > > public function marked(s:String):String { > > > return null; > > > }; > > > } > > > > > > I see two problems with this approach > > > > > >1. inject_html is not valid, So I need other wrapper class to add > the > > >inject_html and use marked within, to make usable as a piece of code > > > (don't > > >like let the user to add the .js script to the html template > > >2. Since is a function I can add other API functions like > setOptions. > > > ie: > > > > > > /** > > > * configure marked with options > > > */ > > > COMPILE::JS > > > public function setOptions(o:Object):void {}; > > > > > > Would like to be know how to declare this as a class to add other > > function > > > APIs available in the js library > > > > > > > > > El mié., 15 abr. 2020 a las 11:14, Yishay Weiss (< > yishayj...@hotmail.com > > >) > > > escribió: > > > > > > > You can just return null. > > > > > > > > I think the best thing for you to do is to go to one of the typedefs, > > > > build, and look at the generated sources. > > > > > > > > For example > > > > > > > > cd …\royale-typedefs > > > > cd google_maps > > > > ant; > > > > cd target\generated-sources > > > > > > > > Explore the .as classes there. > > > > > > > > Hope this helps. > > > > > > > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > > > > Sent: Wednesday, April 15, 2020 12:05 PM > > > > To: Apache Royale Development<mailto:dev@royale.apache.org> > > > > Subject: Re: Problems to create AS3 externs when JS library returns > > some > > > > kind of object > > > > > > > > Hi, > > > > > > > > additional to this, is how we can create an extern function that > return > > > > something: > > > > > > > > public function someFoo(s:String):String {}; > > > > > > > > AS3 expect here some return value inside the brackets. So how we can > > > write > > > > this in AS3 without errors? > > > > > > > > thanks > > > > > > > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira (< > > > carlosrov...@apache.org > > > > >) > > > > escribió: > > > > > > > > > Hi, > >
Re: Problems to create AS3 externs when JS library returns some kind of object
Hi Josh, so if I understand correctly your words, for cases where the function is called the same as the typedef and we have params and return values we need to create a function as I did and then add the rest of functions in separate files in the packaged named the same as the typedef? Regarding "marked" example, I got the initial example working, but I'm trying to configure options that require create internal types in marked, and I'm not got it already. thanks El mié., 15 abr. 2020 a las 18:00, Josh Tynjala () escribió: > It's not ideal, but one way that I've found to define a typedef function > that exposes "static" functions similar to a class is to put those "static" > functions into a package with the same name as the root function. > > package > { > /** > * @externs > */ > COMPILE::JS > public function marked(s:String):String { > return null; > }; > } > > package marked > { > /** > * @externs > * configure marked with options > */ > COMPILE::JS > public function setOptions(o:Object):void {}; > } > > Another option is to use dynamic access, but that won't be checked by the > compiler. > > marked["setOptions"]() > > -- > Josh Tynjala > Bowler Hat LLC <https://bowlerhat.dev> > > > On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira > wrote: > > > Hi Yishay, > > > > this finally worked (declaring as a function): > > > > package > > { > > /** > > * @externs > > */ > > COMPILE::JS > > public function marked(s:String):String { > > return null; > > }; > > } > > > > I see two problems with this approach > > > >1. inject_html is not valid, So I need other wrapper class to add the > >inject_html and use marked within, to make usable as a piece of code > > (don't > >like let the user to add the .js script to the html template > >2. Since is a function I can add other API functions like setOptions. > > ie: > > > > /** > > * configure marked with options > > */ > > COMPILE::JS > > public function setOptions(o:Object):void {}; > > > > Would like to be know how to declare this as a class to add other > function > > APIs available in the js library > > > > > > El mié., 15 abr. 2020 a las 11:14, Yishay Weiss ( >) > > escribió: > > > > > You can just return null. > > > > > > I think the best thing for you to do is to go to one of the typedefs, > > > build, and look at the generated sources. > > > > > > For example > > > > > > cd …\royale-typedefs > > > cd google_maps > > > ant; > > > cd target\generated-sources > > > > > > Explore the .as classes there. > > > > > > Hope this helps. > > > > > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > > > Sent: Wednesday, April 15, 2020 12:05 PM > > > To: Apache Royale Development<mailto:dev@royale.apache.org> > > > Subject: Re: Problems to create AS3 externs when JS library returns > some > > > kind of object > > > > > > Hi, > > > > > > additional to this, is how we can create an extern function that return > > > something: > > > > > > public function someFoo(s:String):String {}; > > > > > > AS3 expect here some return value inside the brackets. So how we can > > write > > > this in AS3 without errors? > > > > > > thanks > > > > > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira (< > > carlosrov...@apache.org > > > >) > > > escribió: > > > > > > > Hi, > > > > > > > > I'm playing with a js markdown library [1] to see if is an option to > > make > > > > a Royale website that load markdown and render it (I'm experimenting > to > > > see > > > > if we can't remove wordpress from our website and make a web based on > > > > markdown similar to royale-docs) > > > > > > > > I'm having problems trying to create the extern as3 file. I'm trying > > > > something similar to what we did with hljs. Here's my try: > > > > > > > > > > > > package > > > > { > > > > /** > > > > * marked js library > > > > */ > > > > COMPILE::JS > > > > public class marked > > > > { > > > > /** > > > > * > > > > * > > > > * https://cdn.jsdeli
Re: Problems to create AS3 externs when JS library returns some kind of object
It's not ideal, but one way that I've found to define a typedef function that exposes "static" functions similar to a class is to put those "static" functions into a package with the same name as the root function. package { /** * @externs */ COMPILE::JS public function marked(s:String):String { return null; }; } package marked { /** * @externs * configure marked with options */ COMPILE::JS public function setOptions(o:Object):void {}; } Another option is to use dynamic access, but that won't be checked by the compiler. marked["setOptions"]() -- Josh Tynjala Bowler Hat LLC <https://bowlerhat.dev> On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira wrote: > Hi Yishay, > > this finally worked (declaring as a function): > > package > { > /** > * @externs > */ > COMPILE::JS > public function marked(s:String):String { > return null; > }; > } > > I see two problems with this approach > >1. inject_html is not valid, So I need other wrapper class to add the >inject_html and use marked within, to make usable as a piece of code > (don't >like let the user to add the .js script to the html template >2. Since is a function I can add other API functions like setOptions. > ie: > > /** > * configure marked with options > */ > COMPILE::JS > public function setOptions(o:Object):void {}; > > Would like to be know how to declare this as a class to add other function > APIs available in the js library > > > El mié., 15 abr. 2020 a las 11:14, Yishay Weiss () > escribió: > > > You can just return null. > > > > I think the best thing for you to do is to go to one of the typedefs, > > build, and look at the generated sources. > > > > For example > > > > cd …\royale-typedefs > > cd google_maps > > ant; > > cd target\generated-sources > > > > Explore the .as classes there. > > > > Hope this helps. > > > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > > Sent: Wednesday, April 15, 2020 12:05 PM > > To: Apache Royale Development<mailto:dev@royale.apache.org> > > Subject: Re: Problems to create AS3 externs when JS library returns some > > kind of object > > > > Hi, > > > > additional to this, is how we can create an extern function that return > > something: > > > > public function someFoo(s:String):String {}; > > > > AS3 expect here some return value inside the brackets. So how we can > write > > this in AS3 without errors? > > > > thanks > > > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira (< > carlosrov...@apache.org > > >) > > escribió: > > > > > Hi, > > > > > > I'm playing with a js markdown library [1] to see if is an option to > make > > > a Royale website that load markdown and render it (I'm experimenting to > > see > > > if we can't remove wordpress from our website and make a web based on > > > markdown similar to royale-docs) > > > > > > I'm having problems trying to create the extern as3 file. I'm trying > > > something similar to what we did with hljs. Here's my try: > > > > > > > > > package > > > { > > > /** > > > * marked js library > > > */ > > > COMPILE::JS > > > public class marked > > > { > > > /** > > > * > > > * > > > * https://cdn.jsdelivr.net/npm/marked/marked.min.js</a> > > > "> > > > * > > > * > > > * @royaleignorecoercion String > > > */ > > > public function marked(s:String):String {}; > > > > > > /** > > > * configure marked with options > > > */ > > > public function setOptions(o:Object):void {}; > > > } > > > } > > > > > > The problem is > > > > > > public function marked(s:String):String {}; > > > > > > since the library gets a String and returns a String, but AS3 > > constructors > > > must be void > > > > > > I remember Josh posted alternative ways to create this kind of AS3 > stubs, > > > but he posted in a paste apache that is now gone. > > > Anyway would be good to know if this is a limitation of AS3 language > and > > > we can't create this kind of AS3 classes that model a JS library with > > > constructors that return something like a string. > > > > > > Thanks > > > > > > [1] https://marked.js.org/#/README.md#usage > > > > > > -- > > > Carlos Rovira > > > http://about.me/carlosrovira > > > > > > > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > > > > > -- > Carlos Rovira > http://about.me/carlosrovira >
Re: Problems to create AS3 externs when JS library returns some kind of object
We really should modify the compiler to allow to be declared on any symbol directly inside a package block. In other words, you should be able to add to a class instead of its constructor (for backwards compatibility, we should continue to allow on a constructor too). Similarly, it should be possible to add to an interface, function, or variable declared in a package. -- Josh Tynjala Bowler Hat LLC <https://bowlerhat.dev> On Wed, Apr 15, 2020 at 7:39 AM Carlos Rovira wrote: > Hi Yishay, > > this finally worked (declaring as a function): > > package > { > /** > * @externs > */ > COMPILE::JS > public function marked(s:String):String { > return null; > }; > } > > I see two problems with this approach > >1. inject_html is not valid, So I need other wrapper class to add the >inject_html and use marked within, to make usable as a piece of code > (don't >like let the user to add the .js script to the html template >2. Since is a function I can add other API functions like setOptions. > ie: > > /** > * configure marked with options > */ > COMPILE::JS > public function setOptions(o:Object):void {}; > > Would like to be know how to declare this as a class to add other function > APIs available in the js library > > > El mié., 15 abr. 2020 a las 11:14, Yishay Weiss () > escribió: > > > You can just return null. > > > > I think the best thing for you to do is to go to one of the typedefs, > > build, and look at the generated sources. > > > > For example > > > > cd …\royale-typedefs > > cd google_maps > > ant; > > cd target\generated-sources > > > > Explore the .as classes there. > > > > Hope this helps. > > > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > > Sent: Wednesday, April 15, 2020 12:05 PM > > To: Apache Royale Development<mailto:dev@royale.apache.org> > > Subject: Re: Problems to create AS3 externs when JS library returns some > > kind of object > > > > Hi, > > > > additional to this, is how we can create an extern function that return > > something: > > > > public function someFoo(s:String):String {}; > > > > AS3 expect here some return value inside the brackets. So how we can > write > > this in AS3 without errors? > > > > thanks > > > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira (< > carlosrov...@apache.org > > >) > > escribió: > > > > > Hi, > > > > > > I'm playing with a js markdown library [1] to see if is an option to > make > > > a Royale website that load markdown and render it (I'm experimenting to > > see > > > if we can't remove wordpress from our website and make a web based on > > > markdown similar to royale-docs) > > > > > > I'm having problems trying to create the extern as3 file. I'm trying > > > something similar to what we did with hljs. Here's my try: > > > > > > > > > package > > > { > > > /** > > > * marked js library > > > */ > > > COMPILE::JS > > > public class marked > > > { > > > /** > > > * > > > * > > > * https://cdn.jsdelivr.net/npm/marked/marked.min.js</a> > > > "> > > > * > > > * > > > * @royaleignorecoercion String > > > */ > > > public function marked(s:String):String {}; > > > > > > /** > > > * configure marked with options > > > */ > > > public function setOptions(o:Object):void {}; > > > } > > > } > > > > > > The problem is > > > > > > public function marked(s:String):String {}; > > > > > > since the library gets a String and returns a String, but AS3 > > constructors > > > must be void > > > > > > I remember Josh posted alternative ways to create this kind of AS3 > stubs, > > > but he posted in a paste apache that is now gone. > > > Anyway would be good to know if this is a limitation of AS3 language > and > > > we can't create this kind of AS3 classes that model a JS library with > > > constructors that return something like a string. > > > > > > Thanks > > > > > > [1] https://marked.js.org/#/README.md#usage > > > > > > -- > > > Carlos Rovira > > > http://about.me/carlosrovira > > > > > > > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > > > > > -- > Carlos Rovira > http://about.me/carlosrovira >
RE: Problems to create AS3 externs when JS library returns some kind of object
Maybe you can create a static function that returns an instance of marked. From: Carlos Rovira<mailto:carlosrov...@apache.org> Sent: Wednesday, April 15, 2020 5:39 PM To: Apache Royale Development<mailto:dev@royale.apache.org> Subject: Re: Problems to create AS3 externs when JS library returns some kind of object Hi Yishay, this finally worked (declaring as a function): package { /** * @externs */ COMPILE::JS public function marked(s:String):String { return null; }; } I see two problems with this approach 1. inject_html is not valid, So I need other wrapper class to add the inject_html and use marked within, to make usable as a piece of code (don't like let the user to add the .js script to the html template 2. Since is a function I can add other API functions like setOptions. ie: /** * configure marked with options */ COMPILE::JS public function setOptions(o:Object):void {}; Would like to be know how to declare this as a class to add other function APIs available in the js library El mié., 15 abr. 2020 a las 11:14, Yishay Weiss () escribió: > You can just return null. > > I think the best thing for you to do is to go to one of the typedefs, > build, and look at the generated sources. > > For example > > cd …\royale-typedefs > cd google_maps > ant; > cd target\generated-sources > > Explore the .as classes there. > > Hope this helps. > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > Sent: Wednesday, April 15, 2020 12:05 PM > To: Apache Royale Development<mailto:dev@royale.apache.org> > Subject: Re: Problems to create AS3 externs when JS library returns some > kind of object > > Hi, > > additional to this, is how we can create an extern function that return > something: > > public function someFoo(s:String):String {}; > > AS3 expect here some return value inside the brackets. So how we can write > this in AS3 without errors? > > thanks > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira ( >) > escribió: > > > Hi, > > > > I'm playing with a js markdown library [1] to see if is an option to make > > a Royale website that load markdown and render it (I'm experimenting to > see > > if we can't remove wordpress from our website and make a web based on > > markdown similar to royale-docs) > > > > I'm having problems trying to create the extern as3 file. I'm trying > > something similar to what we did with hljs. Here's my try: > > > > > > package > > { > > /** > > * marked js library > > */ > > COMPILE::JS > > public class marked > > { > > /** > > * > > * > > * https://cdn.jsdelivr.net/npm/marked/marked.min.js</a> > > "> > > * > > * > > * @royaleignorecoercion String > > */ > > public function marked(s:String):String {}; > > > > /** > > * configure marked with options > > */ > > public function setOptions(o:Object):void {}; > > } > > } > > > > The problem is > > > > public function marked(s:String):String {}; > > > > since the library gets a String and returns a String, but AS3 > constructors > > must be void > > > > I remember Josh posted alternative ways to create this kind of AS3 stubs, > > but he posted in a paste apache that is now gone. > > Anyway would be good to know if this is a limitation of AS3 language and > > we can't create this kind of AS3 classes that model a JS library with > > constructors that return something like a string. > > > > Thanks > > > > [1] https://marked.js.org/#/README.md#usage > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > > > > > -- > Carlos Rovira > http://about.me/carlosrovira > > -- Carlos Rovira http://about.me/carlosrovira
RE: Problems to create AS3 externs when JS library returns some kind of object
In the wrapper class, that is. From: Yishay Weiss Sent: Wednesday, April 15, 2020 6:17:38 PM To: dev@royale.apache.org Subject: RE: Problems to create AS3 externs when JS library returns some kind of object Maybe you can create a static function that returns an instance of marked. From: Carlos Rovira<mailto:carlosrov...@apache.org> Sent: Wednesday, April 15, 2020 5:39 PM To: Apache Royale Development<mailto:dev@royale.apache.org> Subject: Re: Problems to create AS3 externs when JS library returns some kind of object Hi Yishay, this finally worked (declaring as a function): package { /** * @externs */ COMPILE::JS public function marked(s:String):String { return null; }; } I see two problems with this approach 1. inject_html is not valid, So I need other wrapper class to add the inject_html and use marked within, to make usable as a piece of code (don't like let the user to add the .js script to the html template 2. Since is a function I can add other API functions like setOptions. ie: /** * configure marked with options */ COMPILE::JS public function setOptions(o:Object):void {}; Would like to be know how to declare this as a class to add other function APIs available in the js library El mié., 15 abr. 2020 a las 11:14, Yishay Weiss () escribió: > You can just return null. > > I think the best thing for you to do is to go to one of the typedefs, > build, and look at the generated sources. > > For example > > cd …\royale-typedefs > cd google_maps > ant; > cd target\generated-sources > > Explore the .as classes there. > > Hope this helps. > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > Sent: Wednesday, April 15, 2020 12:05 PM > To: Apache Royale Development<mailto:dev@royale.apache.org> > Subject: Re: Problems to create AS3 externs when JS library returns some > kind of object > > Hi, > > additional to this, is how we can create an extern function that return > something: > > public function someFoo(s:String):String {}; > > AS3 expect here some return value inside the brackets. So how we can write > this in AS3 without errors? > > thanks > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira ( >) > escribió: > > > Hi, > > > > I'm playing with a js markdown library [1] to see if is an option to make > > a Royale website that load markdown and render it (I'm experimenting to > see > > if we can't remove wordpress from our website and make a web based on > > markdown similar to royale-docs) > > > > I'm having problems trying to create the extern as3 file. I'm trying > > something similar to what we did with hljs. Here's my try: > > > > > > package > > { > > /** > > * marked js library > > */ > > COMPILE::JS > > public class marked > > { > > /** > > * > > * > > * https://cdn.jsdelivr.net/npm/marked/marked.min.js</a> > > "> > > * > > * > > * @royaleignorecoercion String > > */ > > public function marked(s:String):String {}; > > > > /** > > * configure marked with options > > */ > > public function setOptions(o:Object):void {}; > > } > > } > > > > The problem is > > > > public function marked(s:String):String {}; > > > > since the library gets a String and returns a String, but AS3 > constructors > > must be void > > > > I remember Josh posted alternative ways to create this kind of AS3 stubs, > > but he posted in a paste apache that is now gone. > > Anyway would be good to know if this is a limitation of AS3 language and > > we can't create this kind of AS3 classes that model a JS library with > > constructors that return something like a string. > > > > Thanks > > > > [1] https://marked.js.org/#/README.md#usage > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > > > > > -- > Carlos Rovira > http://about.me/carlosrovira > > -- Carlos Rovira http://about.me/carlosrovira
Re: Problems to create AS3 externs when JS library returns some kind of object
Hi Yishay, this finally worked (declaring as a function): package { /** * @externs */ COMPILE::JS public function marked(s:String):String { return null; }; } I see two problems with this approach 1. inject_html is not valid, So I need other wrapper class to add the inject_html and use marked within, to make usable as a piece of code (don't like let the user to add the .js script to the html template 2. Since is a function I can add other API functions like setOptions. ie: /** * configure marked with options */ COMPILE::JS public function setOptions(o:Object):void {}; Would like to be know how to declare this as a class to add other function APIs available in the js library El mié., 15 abr. 2020 a las 11:14, Yishay Weiss () escribió: > You can just return null. > > I think the best thing for you to do is to go to one of the typedefs, > build, and look at the generated sources. > > For example > > cd …\royale-typedefs > cd google_maps > ant; > cd target\generated-sources > > Explore the .as classes there. > > Hope this helps. > > From: Carlos Rovira<mailto:carlosrov...@apache.org> > Sent: Wednesday, April 15, 2020 12:05 PM > To: Apache Royale Development<mailto:dev@royale.apache.org> > Subject: Re: Problems to create AS3 externs when JS library returns some > kind of object > > Hi, > > additional to this, is how we can create an extern function that return > something: > > public function someFoo(s:String):String {}; > > AS3 expect here some return value inside the brackets. So how we can write > this in AS3 without errors? > > thanks > > El mié., 15 abr. 2020 a las 10:48, Carlos Rovira ( >) > escribió: > > > Hi, > > > > I'm playing with a js markdown library [1] to see if is an option to make > > a Royale website that load markdown and render it (I'm experimenting to > see > > if we can't remove wordpress from our website and make a web based on > > markdown similar to royale-docs) > > > > I'm having problems trying to create the extern as3 file. I'm trying > > something similar to what we did with hljs. Here's my try: > > > > > > package > > { > > /** > > * marked js library > > */ > > COMPILE::JS > > public class marked > > { > > /** > > * > > * > > * https://cdn.jsdelivr.net/npm/marked/marked.min.js</a> > > "> > > * > > * > > * @royaleignorecoercion String > > */ > > public function marked(s:String):String {}; > > > > /** > > * configure marked with options > > */ > > public function setOptions(o:Object):void {}; > > } > > } > > > > The problem is > > > > public function marked(s:String):String {}; > > > > since the library gets a String and returns a String, but AS3 > constructors > > must be void > > > > I remember Josh posted alternative ways to create this kind of AS3 stubs, > > but he posted in a paste apache that is now gone. > > Anyway would be good to know if this is a limitation of AS3 language and > > we can't create this kind of AS3 classes that model a JS library with > > constructors that return something like a string. > > > > Thanks > > > > [1] https://marked.js.org/#/README.md#usage > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > > > > > -- > Carlos Rovira > http://about.me/carlosrovira > > -- Carlos Rovira http://about.me/carlosrovira
RE: Problems to create AS3 externs when JS library returns some kind of object
You can just return null. I think the best thing for you to do is to go to one of the typedefs, build, and look at the generated sources. For example cd …\royale-typedefs cd google_maps ant; cd target\generated-sources Explore the .as classes there. Hope this helps. From: Carlos Rovira<mailto:carlosrov...@apache.org> Sent: Wednesday, April 15, 2020 12:05 PM To: Apache Royale Development<mailto:dev@royale.apache.org> Subject: Re: Problems to create AS3 externs when JS library returns some kind of object Hi, additional to this, is how we can create an extern function that return something: public function someFoo(s:String):String {}; AS3 expect here some return value inside the brackets. So how we can write this in AS3 without errors? thanks El mié., 15 abr. 2020 a las 10:48, Carlos Rovira () escribió: > Hi, > > I'm playing with a js markdown library [1] to see if is an option to make > a Royale website that load markdown and render it (I'm experimenting to see > if we can't remove wordpress from our website and make a web based on > markdown similar to royale-docs) > > I'm having problems trying to create the extern as3 file. I'm trying > something similar to what we did with hljs. Here's my try: > > > package > { > /** > * marked js library > */ > COMPILE::JS > public class marked > { > /** > * > * > * https://cdn.jsdelivr.net/npm/marked/marked.min.js</a> > "> > * > * > * @royaleignorecoercion String > */ > public function marked(s:String):String {}; > > /** > * configure marked with options > */ > public function setOptions(o:Object):void {}; > } > } > > The problem is > > public function marked(s:String):String {}; > > since the library gets a String and returns a String, but AS3 constructors > must be void > > I remember Josh posted alternative ways to create this kind of AS3 stubs, > but he posted in a paste apache that is now gone. > Anyway would be good to know if this is a limitation of AS3 language and > we can't create this kind of AS3 classes that model a JS library with > constructors that return something like a string. > > Thanks > > [1] https://marked.js.org/#/README.md#usage > > -- > Carlos Rovira > http://about.me/carlosrovira > > -- Carlos Rovira http://about.me/carlosrovira
Re: Problems to create AS3 externs when JS library returns some kind of object
Hi Yishay, maybe not. I'm trying, so that could be wrong. Can you show other way? thanks El mié., 15 abr. 2020 a las 11:04, Yishay Weiss () escribió: > I’m confused. Why does marked() need to be a constructor? > > > > *From:* Carlos Rovira > *Sent:* Wednesday, April 15, 2020 11:48:21 AM > *To:* Apache Royale Development > *Subject:* Problems to create AS3 externs when JS library returns some > kind of object > > > > Hi, > > I'm playing with a js markdown library [1] to see if is an option to make a > Royale website that load markdown and render it (I'm experimenting to see > if we can't remove wordpress from our website and make a web based on > markdown similar to royale-docs) > > I'm having problems trying to create the extern as3 file. I'm trying > something similar to what we did with hljs. Here's my try: > > > package > { > /** > * marked js library > */ > COMPILE::JS > public class marked > { > /** > * > * > * https://cdn.jsdelivr.net/npm/marked/marked.min.js"</a>;> > > * > * > * @royaleignorecoercion String > */ > public function marked(s:String):String {}; > > /** > * configure marked with options > */ > public function setOptions(o:Object):void {}; > } > } > > The problem is > > public function marked(s:String):String {}; > > since the library gets a String and returns a String, but AS3 constructors > must be void > > I remember Josh posted alternative ways to create this kind of AS3 stubs, > but he posted in a paste apache that is now gone. > Anyway would be good to know if this is a limitation of AS3 language and we > can't create this kind of AS3 classes that model a JS library with > constructors that return something like a string. > > Thanks > > [1] https://marked.js.org/#/README.md#usage > > -- > Carlos Rovira > http://about.me/carlosrovira > > *From: *Carlos Rovira > *Sent: *Wednesday, April 15, 2020 11:48 AM > *To: *Apache Royale Development > *Subject: *Problems to create AS3 externs when JS library returns some > kind of object > > > > Hi, > > I'm playing with a js markdown library [1] to see if is an option to make a > Royale website that load markdown and render it (I'm experimenting to see > if we can't remove wordpress from our website and make a web based on > markdown similar to royale-docs) > > I'm having problems trying to create the extern as3 file. I'm trying > something similar to what we did with hljs. Here's my try: > > > package > { > /** > * marked js library > */ > COMPILE::JS > public class marked > { > /** > * > * > * https://cdn.jsdelivr.net/npm/marked/marked.min.js"</a>;> > > * > * > * @royaleignorecoercion String > */ > public function marked(s:String):String {}; > > /** > * configure marked with options > */ > public function setOptions(o:Object):void {}; > } > } > > The problem is > > public function marked(s:String):String {}; > > since the library gets a String and returns a String, but AS3 constructors > must be void > > I remember Josh posted alternative ways to create this kind of AS3 stubs, > but he posted in a paste apache that is now gone. > Anyway would be good to know if this is a limitation of AS3 language and we > can't create this kind of AS3 classes that model a JS library with > constructors that return something like a string. > > Thanks > > [1] https://marked.js.org/#/README.md#usage > > -- > Carlos Rovira > http://about.me/carlosrovira > > > -- Carlos Rovira http://about.me/carlosrovira
Re: Problems to create AS3 externs when JS library returns some kind of object
Hi, additional to this, is how we can create an extern function that return something: public function someFoo(s:String):String {}; AS3 expect here some return value inside the brackets. So how we can write this in AS3 without errors? thanks El mié., 15 abr. 2020 a las 10:48, Carlos Rovira () escribió: > Hi, > > I'm playing with a js markdown library [1] to see if is an option to make > a Royale website that load markdown and render it (I'm experimenting to see > if we can't remove wordpress from our website and make a web based on > markdown similar to royale-docs) > > I'm having problems trying to create the extern as3 file. I'm trying > something similar to what we did with hljs. Here's my try: > > > package > { > /** > * marked js library > */ > COMPILE::JS > public class marked > { > /** > * > * > * https://cdn.jsdelivr.net/npm/marked/marked.min.js > "> > * > * > * @royaleignorecoercion String > */ > public function marked(s:String):String {}; > > /** > * configure marked with options > */ > public function setOptions(o:Object):void {}; > } > } > > The problem is > > public function marked(s:String):String {}; > > since the library gets a String and returns a String, but AS3 constructors > must be void > > I remember Josh posted alternative ways to create this kind of AS3 stubs, > but he posted in a paste apache that is now gone. > Anyway would be good to know if this is a limitation of AS3 language and > we can't create this kind of AS3 classes that model a JS library with > constructors that return something like a string. > > Thanks > > [1] https://marked.js.org/#/README.md#usage > > -- > Carlos Rovira > http://about.me/carlosrovira > > -- Carlos Rovira http://about.me/carlosrovira
Problems to create AS3 externs when JS library returns some kind of object
Hi, I'm playing with a js markdown library [1] to see if is an option to make a Royale website that load markdown and render it (I'm experimenting to see if we can't remove wordpress from our website and make a web based on markdown similar to royale-docs) I'm having problems trying to create the extern as3 file. I'm trying something similar to what we did with hljs. Here's my try: package { /** * marked js library */ COMPILE::JS public class marked { /** * * * https://cdn.jsdelivr.net/npm/marked/marked.min.js"> * * * @royaleignorecoercion String */ public function marked(s:String):String {}; /** * configure marked with options */ public function setOptions(o:Object):void {}; } } The problem is public function marked(s:String):String {}; since the library gets a String and returns a String, but AS3 constructors must be void I remember Josh posted alternative ways to create this kind of AS3 stubs, but he posted in a paste apache that is now gone. Anyway would be good to know if this is a limitation of AS3 language and we can't create this kind of AS3 classes that model a JS library with constructors that return something like a string. Thanks [1] https://marked.js.org/#/README.md#usage -- Carlos Rovira http://about.me/carlosrovira