Re: Royale support for progressive web apps (pwa)

2022-03-19 Thread Roman Isitua
Actually the goal is to be able to leverage the new browser api's.


Is there online Documentation about the three levels of integration that
you just listed ?


Or at least if you can point to some simple examples in the royale sdk that
use the three ways of integration that will be helpful. I can study the
source code and learn how it is done.


Last question, (since you mentioned air.) Does royale support deploying to
adobe air for mobile devices ? If yes. How can I leverage air mobile sdk
functionality in a royale app.



On Sun, 20 Mar 2022, 00:23 Alex Harui,  wrote:

> (If you read my thoughts in the “Implementing JS Renderer” thread, you can
> skip the next 6 paragraphs)
>
>
>
> AFAIK, there is no current "Royale way" of creating PWAs.   However, the
> whole point of Royale is to improve developer productivity for common
> patterns.  New patterns become popular every day and it is "just" a matter
> of identifying what parts of those patterns can be made easier via
> declarative syntax (MXML) or strong typing (AS) and updating Royale
> accordingly.
>
>
>
> And while the Basic and especially MXRoyale and SparkRoyale libraries are
> intended to emulate Flex patterns.  There is no requirement for all SWCs to
> emulate Flex patterns.  New patterns might require more compiler changes,
> but are possible.
>
>
>
> Also, IMO, there are 3 "levels" of Royale integration for external
> libraries:  Full, partial, and none.  Full integration generally involves
> wrapping external in AS classes.  Most of the current SWCs do that.  An AS
> Class is instantiated and its APIs do things to some JS library.  That
> generally provides the most developer productivity because the library
> supports MXML (no constructor parameters, more get/set APIs instead of
> functions/methods) and AS (strong typing).  However, that means more code
> runs since you are essentially wrapping a library in a library.
>
>
>
> Partial integration involves creating a few AS classes to talk to the JS
> library.  I think the ACE SWC does is an example of partial integration.
>
>
>
> And "none" means that you are writing code that pretty much calls the
> typedefs directly.
>
>
>
> As you can hopefully see, there is a tradeoff between how much work you
> put into wrapping up external libraries and how easy it is to then write
> code against it.  If you only need to do something once, then it might be
> easier to just hack something to talk to the typedefs.
>
>
>
> Specific to PWAs, I am definitely not an expert on PWAs, but IMO, the link
> posted was for an example of some of the related PWA APIs but didn’t really
> produce anything Progressive.  Reading the MDN articles on PWAs was a bit
> more informative, especially about the two places where the word
> “Progressive” showed up, which was 1) providing progressively more
> functionality based on device capability, and 2) progressively loading the
> application.
>
>
>
> I could argue that Flex and Royale already provide a way of creating PWAs,
> but don’t use the new browser APIs.  AIR-based apps, for example, provide
> offline capabilities.  Proper use of view states provide a different way of
> managing what UI is presented to the users.  And modules provide a way to
> progressively load your app.  What is missing might be capability
> detection, although some of that may already be available by detecting OS
> or via some Cordova libraries.
>
>
>
> But if the goal is to leverage these new browser APIs in Royale, then it
> comes down to picking the level of integration and creating any wrapping
> code if desired.  It would be interesting to see if Royale view states and
> MXML would make it much more efficient to create PWAs.  However, I don’t
> have the time to work on that these days.
>
>
>
> My 2 cents,
>
> -Alex
>
>
>
> *From: *Roman Isitua 
> *Reply-To: *"users@royale.apache.org" 
> *Date: *Monday, March 14, 2022 at 11:17 AM
> *To: *"users@royale.apache.org" 
> *Subject: *Re: Royale support for progressive web apps (pwa)
>
>
>
> Yes. It should be in a similar section to where cordova is.
>
>
>
> On Mon, 14 Mar 2022, 12:23 Andrew Wetmore,  wrote:
>
> Roman, when you get this sorted out, let's figure out where in the
> documentation we should explain how to use Royale to create progressive web
> apps. I presume it would go alongside explaining how to prepare a Royale
> app for use with Cordova to achieve a similar goal.
>
>
>
> a
>
>
>
> On Mon, Mar 14, 2022 at 8:16 AM Roman Isitua 
> wrote:
>
> One question.
>
>
>
>  At which point in the code should the below actionscript code be added.
> Is it in the sp:Application (assuming I am using spectrum) area ? I.e In
> the fx script portion of the mxml ?
>
>
>
> On Mon, 14 Mar 2022, 08:45 Roman Isitua,  wrote:
>
> Wow ! I will definitely try this and provide an update on the outcome.
>
>
>
> On Mon, 14 Mar 2022, 08:42 Harbs,  wrote:
>
> Yes.
>
>
>
> You can put that in a script tag in the html.
>
>
>
> Here’s an ActionScript equivalent of that 

Re: Royale support for progressive web apps (pwa)

2022-03-19 Thread Alex Harui
(If you read my thoughts in the “Implementing JS Renderer” thread, you can skip 
the next 6 paragraphs)



AFAIK, there is no current "Royale way" of creating PWAs.   However, the whole 
point of Royale is to improve developer productivity for common patterns.  New 
patterns become popular every day and it is "just" a matter of identifying what 
parts of those patterns can be made easier via declarative syntax (MXML) or 
strong typing (AS) and updating Royale accordingly.



And while the Basic and especially MXRoyale and SparkRoyale libraries are 
intended to emulate Flex patterns.  There is no requirement for all SWCs to 
emulate Flex patterns.  New patterns might require more compiler changes, but 
are possible.



Also, IMO, there are 3 "levels" of Royale integration for external libraries:  
Full, partial, and none.  Full integration generally involves wrapping external 
in AS classes.  Most of the current SWCs do that.  An AS Class is instantiated 
and its APIs do things to some JS library.  That generally provides the most 
developer productivity because the library supports MXML (no constructor 
parameters, more get/set APIs instead of functions/methods) and AS (strong 
typing).  However, that means more code runs since you are essentially wrapping 
a library in a library.



Partial integration involves creating a few AS classes to talk to the JS 
library.  I think the ACE SWC does is an example of partial integration.



And "none" means that you are writing code that pretty much calls the typedefs 
directly.



As you can hopefully see, there is a tradeoff between how much work you put 
into wrapping up external libraries and how easy it is to then write code 
against it.  If you only need to do something once, then it might be easier to 
just hack something to talk to the typedefs.


Specific to PWAs, I am definitely not an expert on PWAs, but IMO, the link 
posted was for an example of some of the related PWA APIs but didn’t really 
produce anything Progressive.  Reading the MDN articles on PWAs was a bit more 
informative, especially about the two places where the word “Progressive” 
showed up, which was 1) providing progressively more functionality based on 
device capability, and 2) progressively loading the application.

I could argue that Flex and Royale already provide a way of creating PWAs, but 
don’t use the new browser APIs.  AIR-based apps, for example, provide offline 
capabilities.  Proper use of view states provide a different way of managing 
what UI is presented to the users.  And modules provide a way to progressively 
load your app.  What is missing might be capability detection, although some of 
that may already be available by detecting OS or via some Cordova libraries.

But if the goal is to leverage these new browser APIs in Royale, then it comes 
down to picking the level of integration and creating any wrapping code if 
desired.  It would be interesting to see if Royale view states and MXML would 
make it much more efficient to create PWAs.  However, I don’t have the time to 
work on that these days.

My 2 cents,
-Alex

From: Roman Isitua 
Reply-To: "users@royale.apache.org" 
Date: Monday, March 14, 2022 at 11:17 AM
To: "users@royale.apache.org" 
Subject: Re: Royale support for progressive web apps (pwa)

Yes. It should be in a similar section to where cordova is.

On Mon, 14 Mar 2022, 12:23 Andrew Wetmore, 
mailto:cottag...@gmail.com>> wrote:
Roman, when you get this sorted out, let's figure out where in the 
documentation we should explain how to use Royale to create progressive web 
apps. I presume it would go alongside explaining how to prepare a Royale app 
for use with Cordova to achieve a similar goal.

a

On Mon, Mar 14, 2022 at 8:16 AM Roman Isitua 
mailto:romanisi...@gmail.com>> wrote:
One question.

 At which point in the code should the below actionscript code be added. Is it 
in the sp:Application (assuming I am using spectrum) area ? I.e In the fx 
script portion of the mxml ?

On Mon, 14 Mar 2022, 08:45 Roman Isitua, 
mailto:romanisi...@gmail.com>> wrote:
Wow ! I will definitely try this and provide an update on the outcome.

On Mon, 14 Mar 2022, 08:42 Harbs, 
mailto:harbs.li...@gmail.com>> wrote:
Yes.

You can put that in a script tag in the html.

Here’s an ActionScript equivalent of that code:

if ("serviceWorker" in window.navigator) {
  window.addEventListener("load", function():void {
window.navigator.serviceWorker
  .register("/serviceWorker.js")
  .then(function(res):void{trace("service worker registered")})
  .catch(function(err):void{trace("service worker not registered: "+ err)})
  })
}

If there’s no typedef support for serviceWorker you might need to use: 
window.navigator[“serviceWorker”]


On Mar 14, 2022, at 1:00 AM, Roman Isitua 
mailto:romanisi...@gmail.com>> wrote:

From the tutorial the code to register the service worker is as follows:




if ("serviceWorker" in navigator) {

  window.addEventListener("load", 

Really need some help here

2022-03-19 Thread Mark
I’m having a hard time understanding why these eventHandlers will not respond.
I must be missing something very fundamental here.
I’m using Moonshine 3.3.1

I’ve attached the project.
Any help would be greatly appreciated .

This is a very simple app
Heading - button that dispatches a LOGON_REQUESTED event.
All these have a listner with an alert but do not respond.
AppContent  listner for LOGON_REQUESTED event
UserController  listner for LOGON_REQUESTED event
Testing.mxml listner for LOGON_REQUESTED event

<>