Re: RE: Example of access external JS using Apache Royale

2019-05-02 Thread Carlos Rovira
Hi Josh,

I think this piece of knowledge you just exposed here is key for the
success of Royale.

I'll try to use this in TDJ to experiment with it and will use in the blog
example I plan to do.

thanks!


El jue., 2 may. 2019 a las 16:36, Josh Tynjala ()
escribió:

> > Users can't do this, they required that Royale framework devs add
> typedefs to the typedefs repo and wait to next SDK release. What does not
> seems very useful.
>
> Users can create their own typedefs from scratch.
>
> I just created a quick example for hljs, that exposes the highlightBlock()
> function:
>
> https://paste.apache.org/dIq0
>
> Basically, the class needs an asdoc comment with the @externs tag (this is
> something that comes from Google Closure compiler, which we use to create
> release builds) and the compiler should handle the rest.
>
> As I understand it, you don't even need to create a SWC library for custom
> typedefs. Recently, Alex mentioned that the mxmlc compiler is smart enough
> to handle a source file as long as it has the @externs tag.
>
> - Josh
>
> On 2019/05/02 09:34:37, Carlos Rovira  wrote:
> > Hi,
> >
> > to sumarize (let me know if I'm wrong), the current ways to integrate an
> > existing library are 3:
> >
> > 1.- access vía brackets notation: This is the most easy and direct, an
> > example is TourDeJewel in class utils.HighlightCode
> >
> > var hljs:Object = window["hljs"];
> > hljs["highlightBlock"](block);
> >
> > but this one is not what we really want since we are going with Roayle
> and
> > AS3 to get type checking and strong typing. So this, although useful is
> not
> > what we really want to use in out Apps, but since we want to maintain the
> > dynamic aspect of the language it could be very useful sometimes
> >
> > 2.- using typedefs
> >
> > This will be the next step to use a real type and dot notation, but seems
> > not easy or direct.
> > Users can't do this, they required that Royale framework devs add
> typedefs
> > to the typedefs repo and wait to next SDK release. What does not seems
> very
> > useful.
> >
> > In the other hand we'll need to know how to extend current typedefs since
> > don't know if we have docs about this. Until now I added to "missing.js"
> > file fo now, but this doesn't seems a valid path since it lacks
> > organization, separation, and a way for all people contributing to know
> wha
> > we have, what can be added and where, if not we'll find in time lots of
> > code very difficult to maintain.
> >
> > Yishay and Josh talked about to use TypeScript, but seems that is already
> > explored by Josh but not a valid path since will be very difficult to
> > maintain.
> >
> > 3.- wrapping libraries
> >
> > This is how we did with MDL. This will be recommended when we want to
> > integrate existing libraries with Royale to make it work with our APIs
> in a
> > more seamless way. But the problems is that this is very laborious. Can
> be
> > useful for some concrete libraries and we should do when needed (the case
> > is MDL). But the problem is that this not solve the problem of our users
> > that need to integrate a existing library themselves in a quick way.
> >
> > Let me know if you know other way.
> >
> > For me method 1, is ok to do the work, but doesn't make us justice.
> > method 2 should be the main one if there's a fast and easy way... I'm
> > missing something here? Can users create typedefs themselves?
> > method 3 can be useful for us or for users (doing their own libs, and
> > eventually can share with us to add to official royale repo and sdk)
> > but is something not fast at all and not as convenient and direct as
> method
> > 2, and will require maintenance as libs change.
> >
> > Could we agree that this is the currently available ways in Royale now to
> > use external JS libs?
> >
> > thanks
> >
> > --
> > Carlos Rovira
> > http://about.me/carlosrovira
> >
>


-- 
Carlos Rovira
http://about.me/carlosrovira


RE: RE: Example of access external JS using Apache Royale

2019-05-02 Thread Yishay Weiss
Helpful, thanks.




From: Josh Tynjala 
Sent: Thursday, May 2, 2019 5:36:35 PM
To: dev@royale.apache.org
Subject: Re: RE: Example of access external JS using Apache Royale

> Users can't do this, they required that Royale framework devs add typedefs to 
> the typedefs repo and wait to next SDK release. What does not seems very 
> useful.

Users can create their own typedefs from scratch.

I just created a quick example for hljs, that exposes the highlightBlock() 
function:

https://paste.apache.org/dIq0

Basically, the class needs an asdoc comment with the @externs tag (this is 
something that comes from Google Closure compiler, which we use to create 
release builds) and the compiler should handle the rest.

As I understand it, you don't even need to create a SWC library for custom 
typedefs. Recently, Alex mentioned that the mxmlc compiler is smart enough to 
handle a source file as long as it has the @externs tag.

- Josh

On 2019/05/02 09:34:37, Carlos Rovira  wrote:
> Hi,
>
> to sumarize (let me know if I'm wrong), the current ways to integrate an
> existing library are 3:
>
> 1.- access vía brackets notation: This is the most easy and direct, an
> example is TourDeJewel in class utils.HighlightCode
>
> var hljs:Object = window["hljs"];
> hljs["highlightBlock"](block);
>
> but this one is not what we really want since we are going with Roayle and
> AS3 to get type checking and strong typing. So this, although useful is not
> what we really want to use in out Apps, but since we want to maintain the
> dynamic aspect of the language it could be very useful sometimes
>
> 2.- using typedefs
>
> This will be the next step to use a real type and dot notation, but seems
> not easy or direct.
> Users can't do this, they required that Royale framework devs add typedefs
> to the typedefs repo and wait to next SDK release. What does not seems very
> useful.
>
> In the other hand we'll need to know how to extend current typedefs since
> don't know if we have docs about this. Until now I added to "missing.js"
> file fo now, but this doesn't seems a valid path since it lacks
> organization, separation, and a way for all people contributing to know wha
> we have, what can be added and where, if not we'll find in time lots of
> code very difficult to maintain.
>
> Yishay and Josh talked about to use TypeScript, but seems that is already
> explored by Josh but not a valid path since will be very difficult to
> maintain.
>
> 3.- wrapping libraries
>
> This is how we did with MDL. This will be recommended when we want to
> integrate existing libraries with Royale to make it work with our APIs in a
> more seamless way. But the problems is that this is very laborious. Can be
> useful for some concrete libraries and we should do when needed (the case
> is MDL). But the problem is that this not solve the problem of our users
> that need to integrate a existing library themselves in a quick way.
>
> Let me know if you know other way.
>
> For me method 1, is ok to do the work, but doesn't make us justice.
> method 2 should be the main one if there's a fast and easy way... I'm
> missing something here? Can users create typedefs themselves?
> method 3 can be useful for us or for users (doing their own libs, and
> eventually can share with us to add to official royale repo and sdk)
> but is something not fast at all and not as convenient and direct as method
> 2, and will require maintenance as libs change.
>
> Could we agree that this is the currently available ways in Royale now to
> use external JS libs?
>
> thanks
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>


Re: RE: Example of access external JS using Apache Royale

2019-05-02 Thread Josh Tynjala
> Users can't do this, they required that Royale framework devs add typedefs to 
> the typedefs repo and wait to next SDK release. What does not seems very 
> useful.

Users can create their own typedefs from scratch.

I just created a quick example for hljs, that exposes the highlightBlock() 
function:

https://paste.apache.org/dIq0

Basically, the class needs an asdoc comment with the @externs tag (this is 
something that comes from Google Closure compiler, which we use to create 
release builds) and the compiler should handle the rest.

As I understand it, you don't even need to create a SWC library for custom 
typedefs. Recently, Alex mentioned that the mxmlc compiler is smart enough to 
handle a source file as long as it has the @externs tag.

- Josh

On 2019/05/02 09:34:37, Carlos Rovira  wrote: 
> Hi,
> 
> to sumarize (let me know if I'm wrong), the current ways to integrate an
> existing library are 3:
> 
> 1.- access vía brackets notation: This is the most easy and direct, an
> example is TourDeJewel in class utils.HighlightCode
> 
> var hljs:Object = window["hljs"];
> hljs["highlightBlock"](block);
> 
> but this one is not what we really want since we are going with Roayle and
> AS3 to get type checking and strong typing. So this, although useful is not
> what we really want to use in out Apps, but since we want to maintain the
> dynamic aspect of the language it could be very useful sometimes
> 
> 2.- using typedefs
> 
> This will be the next step to use a real type and dot notation, but seems
> not easy or direct.
> Users can't do this, they required that Royale framework devs add typedefs
> to the typedefs repo and wait to next SDK release. What does not seems very
> useful.
> 
> In the other hand we'll need to know how to extend current typedefs since
> don't know if we have docs about this. Until now I added to "missing.js"
> file fo now, but this doesn't seems a valid path since it lacks
> organization, separation, and a way for all people contributing to know wha
> we have, what can be added and where, if not we'll find in time lots of
> code very difficult to maintain.
> 
> Yishay and Josh talked about to use TypeScript, but seems that is already
> explored by Josh but not a valid path since will be very difficult to
> maintain.
> 
> 3.- wrapping libraries
> 
> This is how we did with MDL. This will be recommended when we want to
> integrate existing libraries with Royale to make it work with our APIs in a
> more seamless way. But the problems is that this is very laborious. Can be
> useful for some concrete libraries and we should do when needed (the case
> is MDL). But the problem is that this not solve the problem of our users
> that need to integrate a existing library themselves in a quick way.
> 
> Let me know if you know other way.
> 
> For me method 1, is ok to do the work, but doesn't make us justice.
> method 2 should be the main one if there's a fast and easy way... I'm
> missing something here? Can users create typedefs themselves?
> method 3 can be useful for us or for users (doing their own libs, and
> eventually can share with us to add to official royale repo and sdk)
> but is something not fast at all and not as convenient and direct as method
> 2, and will require maintenance as libs change.
> 
> Could we agree that this is the currently available ways in Royale now to
> use external JS libs?
> 
> thanks
> 
> -- 
> Carlos Rovira
> http://about.me/carlosrovira
> 


Re: RE: Example of access external JS using Apache Royale

2019-05-02 Thread Carlos Rovira
Hi,

to sumarize (let me know if I'm wrong), the current ways to integrate an
existing library are 3:

1.- access vía brackets notation: This is the most easy and direct, an
example is TourDeJewel in class utils.HighlightCode

var hljs:Object = window["hljs"];
hljs["highlightBlock"](block);

but this one is not what we really want since we are going with Roayle and
AS3 to get type checking and strong typing. So this, although useful is not
what we really want to use in out Apps, but since we want to maintain the
dynamic aspect of the language it could be very useful sometimes

2.- using typedefs

This will be the next step to use a real type and dot notation, but seems
not easy or direct.
Users can't do this, they required that Royale framework devs add typedefs
to the typedefs repo and wait to next SDK release. What does not seems very
useful.

In the other hand we'll need to know how to extend current typedefs since
don't know if we have docs about this. Until now I added to "missing.js"
file fo now, but this doesn't seems a valid path since it lacks
organization, separation, and a way for all people contributing to know wha
we have, what can be added and where, if not we'll find in time lots of
code very difficult to maintain.

Yishay and Josh talked about to use TypeScript, but seems that is already
explored by Josh but not a valid path since will be very difficult to
maintain.

3.- wrapping libraries

This is how we did with MDL. This will be recommended when we want to
integrate existing libraries with Royale to make it work with our APIs in a
more seamless way. But the problems is that this is very laborious. Can be
useful for some concrete libraries and we should do when needed (the case
is MDL). But the problem is that this not solve the problem of our users
that need to integrate a existing library themselves in a quick way.

Let me know if you know other way.

For me method 1, is ok to do the work, but doesn't make us justice.
method 2 should be the main one if there's a fast and easy way... I'm
missing something here? Can users create typedefs themselves?
method 3 can be useful for us or for users (doing their own libs, and
eventually can share with us to add to official royale repo and sdk)
but is something not fast at all and not as convenient and direct as method
2, and will require maintenance as libs change.

Could we agree that this is the currently available ways in Royale now to
use external JS libs?

thanks

-- 
Carlos Rovira
http://about.me/carlosrovira


Re: RE: Example of access external JS using Apache Royale

2019-05-01 Thread Josh Tynjala
You still need write the Royale typedefs manually. However, referring to the 
TypeScript definitions while you do it makes things easier. TypeScript 
definitions are limited to the API surface only, without implementations of 
everything, so you don't need to sift through the entire JS library to find the 
only function signatures and things that you need. Additionally, they are 
typed, like ActionScript, so you'll probably end up creating similar types.

I tried to create a converter (which I called dts2as) to automatically generate 
Royale typedefs from TypeScript type definitions, but it was too hard to keep 
up to date. People in the TypeScript community start using new language 
features in their type definitions as soon as a new version of TypeScript is 
released, so it was a constant game of catching up. A new version of TypeScript 
would be released, and type definitions for libraries that had been compatible 
with dts2as suddenly didn't work anymore. It would have been a full time job to 
maintain this program.

- Josh

On 2019/05/01 07:33:08, Yishay Weiss  wrote: 
> How can use the TypeScript definitions to create typedefs?
> 
> >Looks like there is TypeScript defnitions for lodash on DefinitelyTyped and 
> >Moment ships >with a TypeScript definitions.
> 
> On 4/30/19, 10:18 PM, "Dany Dhondt"  wrote:
> 
> Wouldn’t it be a nice proof of concept if we tried to implement a widely 
> used js lib into Royale?
> There are a lot of js packages that are used thousands of times a day, 
> like moment.js, lodash, …
> 
> Dany
> 
> > Op 1 mei 2019, om 01:13 heeft Alex Harui  het 
> volgende geschreven:
> >
> > Isn't the ACE editor already an example?  Or maybe there are different 
> scenarios for external JS usage.
> >
> > -Alex
> >
> > On 4/30/19, 2:42 PM, "Carlos Rovira"  > wrote:
> >
> >Hi,
> >
> >I'm planing to make a blog example about using external JS or CSS in 
> Apache
> >Royale since people ask for it, and I think is one of the key points 
> for
> >people that wants to use Royale.
> >My plan is to create a simple example that imports a JS script and 
> then use
> >bracket access. The example in concrete will use the script for 
> coloring
> >code that we use in TDJ that is external to Royale to show how we do 
> it.
> >
> >But I think that's just one of the ways to use external JS (bracket
> >notation access).
> >I think there's more:
> >- dot notation -> but this required typedefs (Let me know if I'm 
> wrong).
> >and in that case, I don't have clear where we can add code to 
> typedefs to
> >do this. In the other way, how users can do something like this in 
> their
> >codebases. For me this is unexplored terrain, so hope others that 
> knows
> >about it could give some techniques, or point to some docs if we 
> already
> >has something. Maybe it could be great they could write some doc in 
> our
> >GitHub pages
> >
> >- More ways?? Let me know.
> >
> >I can work on this in few days , hope you could let me know about 
> those
> >alternate methods I didn't control
> >
> >thanks
> >
> >--
> >Carlos Rovira
> >
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira=02%7C01%7Caharui%40adobe.com%7Cf423a553176c417709a808d6cdf47e15%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636922847343802698=aE74z47Qoowlb3b6KZpzpd6jsRY06RIq74BNhakX5ew%3D=0
>  
> 
> 
> 
>