> It might be worth finding examples for other bootstrap infrastructure, or
> hand-creating some on your own then comparing patterns with what we’re
> doing for Google Closure.
Sorry for my lack of understanding this terminology, what do you mean by
"bootstrap infrastructure", can you give an example.
Btw, I've been trying to create a function to dynamically load scripts and once
those loaded call a callback, it worked but JQuery didn't responded as expected
despite I was seeing it fully loaded, I don't know what I missed but in case it
would have worked, I intended to create a better framework utility class
instead of this function, maybe someone better in JS can make it work:
private static function importScripts(scripts:Array, onLoaded:Function =
null):void {
const head:HTMLHeadElement = window.document.head ||
window.document.getElementsByTagName("head")[0];
var scriptsToLoad:Number = scripts.length;
function onError(error:ErrorEvent):void {
throw new URIError("The script " +
HTMLScriptElement(error.target).src + " is not accessible.");
}
function loadNextScript():void {
if (scriptsToLoad> 0) {
var script:HTMLScriptElement = document.createElement("script")
as HTMLScriptElement;
script.type = "text\/javascript";
script.lang = "Javascript";
script.onerror = onError;
script.onload = loadNextScript;
head.appendChild(script);
script.src = scripts[--scriptsToLoad];
} else if (onLoaded)
onLoaded();
}
loadNextScript();
}
private static const JQUERY_SCRIPT:String =
'https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js';
private function start():void {
importScripts([JQUERY_SCRIPT], init);
The JQuery code in the init function doesn't work despite the lib has been
loaded (to be sure I had even a version using setInterval t ocheck if
window["jQuery"] was present and it was), if instead I add a script tag with
the src attribute pointing to JQuery, it works.
Frédéric THOMAS
----------------------------------------
> From: [email protected]
> To: [email protected]
> Subject: Re: [FalconJX FlexJS] JQuery up and running, a nightmare but we now
> have 1.9 in AS
> Date: Tue, 23 Jun 2015 00:19:36 +0000
>
>
>
> On 6/22/15, 2:50 PM, "Frédéric THOMAS" <[email protected]> wrote:
>
>>> I’ve been pondering what the packaging options might be. Right now folks
>>> are getting things to run because after we cross-compile the AS to JS,
>>> Google Closure Library classes are mixed in in order to get scripts
>>> loaded, and an index.html is generated to call all of that. We might
>>>give
>>> folks options for different “Publishers" that package different
>>> bootstrapping infrastructure with the cross-compiled code.
>>
>>Just been back in front of my computer, was out and I'm almost about
>>going to sleep but was wondering, in the user perspective how it would
>>look like having different publishers that package different
>>bootstrapping infrastructure with the cross-compiled code ?
>>
>>I was thinking much more about loading scripts or css from AS at Class
>>level, a thing like:
>>[dowloadJSlibrary(src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/
>>jquery.min.js', type='text/javascript')]
>
> It might be worth finding examples for other bootstrap infrastructure, or
> hand-creating some on your own then comparing patterns with what we’re
> doing for Google Closure.
>
> The FlexJS Publisher handles CSS aggregated from defaults.css files in the
> SWCs
>
> -Alex
>