Sweet!

On 1/11/16, 8:26 PM, "Josh Tynjala" <joshtynj...@gmail.com> wrote:

>You would need to use a utility like externc or dts2as, if you wanted to
>get code suggestions in an IDE or strict type checking with the compiler.
>
>Out of the box, dynamic access will always work:
>
>var example_module:Object = require("example");
>
>You can access anything on example_module because it's an Object, but if
>you make a typo, or try to access something that doesn't exist, the
>compiler won't complain. Ideally, we'd like to avoid that.
>
>However, if you find some externs or TypeScript definitions, you can
>create
>a SWC with externc or dts2as. Then, you'll be able to specify a type on
>the
>result of require() to give the full APIs to the compiler and IDEs:
>
>var example_module:example = require("example");
>
>You'd simply add the SWC to the external library path, similar to
>playerglobal.swc, js.swc, or any other third party JS library.
>
>I should mention that I added a node.swc to FlexJS, built from externs.
>Right now, it only defines the signature of require(), but I'd like for us
>to expand it to provide APIs for all of Node's built-in modules.
>
>- Josh
>On Jan 11, 2016 6:30 PM, "OmPrakash Muppirala" <bigosma...@gmail.com>
>wrote:
>
>> I am trying to digest how this works.  So, if I npm install a random
>> module, what would I need to do to make the code complete, compiler,
>>etc.
>> to work with that new module?
>>
>> Thanks,
>> Om
>>
>> On Mon, Jan 11, 2016 at 5:29 PM, OmPrakash Muppirala
>><bigosma...@gmail.com
>> >
>> wrote:
>>
>> > Whoaaa!
>> >
>> > On Mon, Jan 11, 2016 at 5:25 PM, Josh Tynjala <joshtynj...@gmail.com>
>> > wrote:
>> >
>> >> FalconJX just got Node.js support today.
>> >>
>> >> //--- begin HelloNode.as
>> >>
>> >> package
>> >> {
>> >>     public class HelloNode
>> >>     {
>> >>         public function HelloNode()
>> >>         {
>> >>             trace("Hello Node!");
>> >>             trace(process.version);
>> >>         }
>> >>     }
>> >> }
>> >> var process:Object = require("process");
>> >>
>> >> //--- end HelloNode.as
>> >>
>> >> //--- begin usage
>> >>
>> >> asnodec HelloNode.as
>> >> node bin/js-debug/index.js
>> >>
>> >> //--- end usage
>> >>
>> >> I'm sure there are bugs. I probably forgot to add something
>>important in
>> >> the build script, but it works on my machine! :)
>> >>
>> >> - Josh
>> >>
>> >
>> >
>>

Reply via email to