OK, got rid of the CSS. The JS output now looks like:
/**
* Main
*
* @fileoverview
*
* @suppress {checkTypes}
*/
goog.provide('Main');
/**
* @constructor
*/
Main = function() {
};
/**
* @expose
*/
Main.prototype.start = function() {
var self = this;
var /** @type {Element} */ element = document.createElement("button");
element.onclick = function() {
alert("Hello browser from FalconJX!");
};
element.textContent = "Say Hello";
document.body.appendChild(element);
};
/**
* Metadata
*
* @type {Object.<string, Array.<Object>>}
*/
Main.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Main', qName:
'Main'}] };
// Ensures the symbol will be visible after compiler renaming.
goog.exportSymbol('Main', Main);
Have fun,
-Alex
On 6/14/15, 10:04 PM, "Alex Harui" <aharui@adobe.com> wrote:
>OK, I believe that if you go and install the FlexJS Nightly, you can go to
>the folder where you installed it and type:
>
>On OSX:
> js/bin/jsc path/to/Main.as
>
>On Windows:
> js\bin\jsc.bat path\to\Main.as
>
>And you’ll get a JS file out. The JS file has some extra CSS stuffed on
>the end that I’m going to try to remove tonight. Also, on Windows, you
>may need to make sure that jsc.bat is using Java 1.7 or later. The
>Installer sometime finds old Java 1.6 installs.
>
>The Main.as I tried looks like this:
>
>package
>{
> public class Main
> {
> public function start():void
> {
> var element:Element = document.createElement("button");
> element.onclick = function ():void {
> alert("Hello browser from FalconJX!");
> };
> element.textContent = "Say Hello";
> document.body.appendChild(element);
> }
> }
>}
>
>
>I haven’t tried all this in FB yet. I would think you would have to
>create an ActionScript project and add JS.swc, which is currently in
>js/libs/temp/externals/bin. I might move the swc up under js/libs soon.
>
>The JS output will have goog.provide, goog.require and goog.inherit in it,
>and org.apache.flex.utils.Language if you used “is” or “as”. This is what
>I plan to use to write the JS code for FlexJS, and once your test gets
>more sophisticated, you’ll need some sort of dependency management and
>subclassing scheme. This will hopefully make it easier for folks to see
>where we might swap out the goog stuff for alternatives.
>
>Let us know if it doesn’t work for you.
>
>-Alex
>
|