Re: Trying to run a function on a class that is not instantiated

2019-07-02 Thread Carlos Rovira
Hi Alex, I finally solved in my latest commit. Thanks for the guidance :) Carlos El mar., 2 jul. 2019 a las 17:00, Carlos Rovira () escribió: > Hi Alex, > > ok, I understand now. You propose to do something like we do for > Application but for Modules using the same kind of process but instead

Re: Trying to run a function on a class that is not instantiated

2019-07-02 Thread Carlos Rovira
Hi Alex, ok, I understand now. You propose to do something like we do for Application but for Modules using the same kind of process but instead of adding to html head create a new .js to be added like _deps,js. I think that will be ok and even more efficient since all is done by compiler. I'll tr

Re: Trying to run a function on a class that is not instantiated

2019-07-01 Thread Alex Harui
On 7/1/19, 9:42 AM, "Carlos Rovira" wrote: > So, inject_html in a module should do effectively the same thing, except I > don't think a module needs to inject HTML, right, we don't want to do that will defeat the module's purpose of deferred loading. And moreover, we

Re: Trying to run a function on a class that is not instantiated

2019-07-01 Thread Carlos Rovira
Hi Alex El lun., 1 jul. 2019 a las 6:52, Alex Harui () escribió: > If inject_html works in the app, that's essentially because the app.js > doesn't get loaded and run until the injected html is executed. > > yeah, that's clear to me. > So, inject_html in a module should do effectively the same

Re: Trying to run a function on a class that is not instantiated

2019-06-30 Thread Alex Harui
If inject_html works in the app, that's essentially because the app.js doesn't get loaded and run until the injected html is executed. So, inject_html in a module should do effectively the same thing, except I don't think a module needs to inject HTML, it can just take a list of urls to load as

Re: Trying to run a function on a class that is not instantiated

2019-06-30 Thread Carlos Rovira
@Harbs, A final thought, as you can see in the problem described, I don't want the user, or Module or Application knows about any setup. I just want that knowledge is in the Class itself and be performed just by implementing "IModuleInfo" in its "setup()" method. El dom., 30 jun. 2019 a las 11:47,

Re: Trying to run a function on a class that is not instantiated

2019-06-30 Thread Carlos Rovira
Hi Harbs, thanks for proposal, but I think still the problem is not clear enough what is causing confusion. I think we have actually the capability to chain actions with events as the module load (description of the process below). What I'm pursuing is that a Royale Class present in a Module can p

Re: Trying to run a function on a class that is not instantiated

2019-06-30 Thread Harbs
What about another approach? Maybe modules can have a two-step initialization: 1. If there are dependencies, those are loaded with a callback. 2. Once all the dependencies are loaded, the module is actually initialized and dispatches some events. That way, the parent application does not need to

Re: Trying to run a function on a class that is not instantiated

2019-06-30 Thread Carlos Rovira
Hi Alex, ok, then can we? 1.- *load the module (*but still not add it to app, so no start to run) 2.- *inspect the classes loaded in the module* to know what of them implements a concrete interface (let's call "IModuleInfo") 3.- *set up script and link tags* but running IModuleInfo.setup() in all

Re: Trying to run a function on a class that is not instantiated

2019-06-29 Thread Alex Harui
The whole reason for inject_html is so some 3rd party JS can be loaded before Royale JS code starts using it. Because the loading of the 3rd-party code is a server request and possibly asynchronous, I don't think we want a pattern where the class that needs some 3rd party code tries to load tha

Re: Trying to run a function on a class that is not instantiated

2019-06-29 Thread Carlos Rovira
Hi Alex, yes the solution is that, so to add dynamically a css or javascript I want to do the same way you did in UIModuleUtils.createLoader(), where you create a "link" element or a "script" element. What I really ask is how to trigger a method like that in (lets say) package.MyClass when a user

Re: Trying to run a function on a class that is not instantiated

2019-06-28 Thread Alex Harui
Take a look at UIModuleLoader and UIModuleUtils. Already it creates several HTML script and link tags to load a js-debug module. The patterns are already there to use as a template to load another script tag that will add other script tags to the DOM or do just about anything you want. You c

Re: Trying to run a function on a class that is not instantiated

2019-06-28 Thread Carlos Rovira
For watt you say, I'm more with the second part of your response where we can alter the compiler to modify the additionalHTML, but I think that should be based on inject_html like we do in Application. I remember that this problem is less related to a loading of resources problem, that we need to w

Re: Trying to run a function on a class that is not instantiated

2019-06-28 Thread Alex Harui
In a quick peek at the code, the ModuleLoader already loads more than one file. It should be relatively simple to have a subclass or alternate ModuleLoaderWithPreloader that loads an additional file that loads the third-party JS. Also, it appears that it should be relatively simple to alter th

Re: Trying to run a function on a class that is not instantiated

2019-06-27 Thread Carlos Rovira
I'm with you that we can make the compiler optimize the class and just add the constants used, but I think that's is just an optimization issue. A user will want to use constants this way. They even could create a reduced class with just the constants he needs. About preloader, I'm interested in s

Re: Trying to run a function on a class that is not instantiated

2019-06-27 Thread Carlos Rovira
Hi Harbs, thanks for the suggestion. Yes, I remember that function that is very convenient. But can't be use in this concrete use case. I want the user use MaterialIconType class as always, and that's just bind to one of the constants in the class. In the application, the inject_html is processed,

Re: Trying to run a function on a class that is not instantiated

2019-06-27 Thread Carlos Rovira
Hi Alex, in this concrete use case (a basic module scenario), I can confirm a preloader is not necessary, since I tested the code and it works fine. My problem is different. I want the user to avoid a call to loadCSS, since just using the MaterialIconType Royale should add implicitly the link tag

Re: Trying to run a function on a class that is not instantiated

2019-06-27 Thread Harbs
I also don’t know that abstracting this too much is a good thing. It’s a fair trade-off to require declaring external dependencies. It also allows for controlling where the dependencies are coming from, versioning, etc. To me the pattern should be something like this: 1. Add a preloader bead to

Re: Trying to run a function on a class that is not instantiated

2019-06-27 Thread Harbs
Have you looked at addDynamicSelector()? > On Jun 26, 2019, at 6:16 PM, Carlos Rovira wrote: > > I created as well "loadCSS" (still not commited).

Re: Trying to run a function on a class that is not instantiated

2019-06-27 Thread Alex Harui
I'm pretty sure in related threads I mentioned that a preloader is needed. -Alex On 6/26/19, 8:16 AM, "Carlos Rovira" wrote: Thanks Spiros, My real problem is the following. I'm trying to improve Modules. I found that inject_html don't work with modules, Inject_html is process

Re: Trying to run a function on a class that is not instantiated

2019-06-26 Thread Carlos Rovira
Thanks Spiros, My real problem is the following. I'm trying to improve Modules. I found that inject_html don't work with modules, Inject_html is processed by compiler. To solve in an easy way I'm trying to load CSS and JS with javascript appending to head. When I load the module and I use a class

RE: Trying to run a function on a class that is not instantiated

2019-06-26 Thread spiros
It is possible with static getter and seter. Maybe will help you the code below Spiros. public class Variable { private static var _textData:String; public static function get textData():String { i