Constructor .. How would you define that as an extern????

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Constructor .. How would you define that as an extern????

sledorze
got this Js:
                var FacebookClient = require('facebook-client').FacebookClient;
                var facebook = new FacebookClient();

I want to port it to haxe as an extern..
how may I represent the constructor ?

Thanks,

Stephane
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

clemos
package facebook;
@:native("FacebookClient")
extern class FacebookClient {
   public function new() : Void;
}

Regards,
Clément

On Wed, Oct 12, 2011 at 5:04 PM, sledorze <[hidden email]> wrote:

> got this Js:
>                var FacebookClient = require('facebook-client').FacebookClient;
>                var facebook = new FacebookClient();
>
> I want to port it to haxe as an extern..
> how may I represent the constructor ?
>
> Thanks,
>
> Stephane
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6885347.html
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

sledorze
The problem is not really that but the fact the class is passed by the value (FacebookClient - forgot the first upper F)..

var FacebookClient = require('facebook-client').FacebookClient; 
var facebook = new FacebookClient();


On Wed, Oct 12, 2011 at 5:13 PM, clemos [via Haxe] <[hidden email]> wrote:
package facebook;
@:native("FacebookClient")
extern class FacebookClient {
   public function new() : Void;
}

Regards,
Clément

On Wed, Oct 12, 2011 at 5:04 PM, sledorze <[hidden email]> wrote:

> got this Js:
>                var FacebookClient = require('facebook-client').FacebookClient;
>                var facebook = new FacebookClient();
>
> I want to port it to haxe as an extern..
> how may I represent the constructor ?
>
> Thanks,
>
> Stephane
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6885347.html
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org



If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6885371.html
To unsubscribe from Constructor .. How would you define that as an extern????, click here.



--
Stéphane Le Dorze


Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

sledorze
In reply to this post by sledorze
For more information, the new I am refering to is javascript 'new'.
You may find a good explanation why it is not the same thing than in haxe (coz of it's prototype based nature), here:
http://stackoverflow.com/questions/1646698/what-is-the-new-keyword-in-javascript

the only issue with haxe when using javascript app is that this is not possible to express the same stuff without relying on an helper method using __js__ .

Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

Tony Polinelli
Use the magic __init__ on the class to run you first line of code 'var Facebook = require...' then the 'native will exist for the @native... Maybe?



On Wednesday, October 12, 2011, sledorze <[hidden email]> wrote:
> For more information, the new I am refering to is javascript 'new'.
> You may find a good explanation why it is not the same thing than in haxe
> (coz of it's prototype based nature), here:
> http://stackoverflow.com/questions/1646698/what-is-the-new-keyword-in-javascript
>
> the only issue with haxe when using javascript app is that this is not
> possible to express the same stuff without relying on an helper method using
> __js__ .
>
>
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886597.html
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

sledorze
It's not a class; it's a prototype object returned at runtime..
new in javascript also means something like "clone and share my prototype"..
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

Cauê W.
stephane, can you send us a little more of your example? I don't know what you're trying to do and where is this code located at

2011/10/12 sledorze <[hidden email]>
It's not a class; it's a prototype object returned at runtime..
new in javascript also means something like "clone and share my prototype"..


--
View this message in context: http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886862.html
Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

sledorze
The code is extracted from the facebook sample app for node.js.

The problem is really related to the js use of 'new' that does not translate in haxe 'new'.


the 'require' method is a NodeJs method that loads a js module; in this case; it's the facebook one.

here's the related file:
https://github.com/DracoBlue/node-facebook-client/blob/master/lib/facebook-client/FacebookClient.js

My code (the sample code) only uses the getSessionByAccessToken function of the prototype you may find in this file.

I think my post title is misleading as there no constructors involved actually, it would just be a way to lure haxe in order to generate the awaited javascript code..
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

clemos
See how the JQuery extern is inited :
http://code.google.com/p/haxe/source/browse/trunk/std/js/JQuery.hx#310

In your FaceBookClient class, you should be able to this to
include/require the file:
private static function __init__(){
  var lib : Dynamic = untyped require('facebook-client');
  FaceBookClient = lib.FaceBookClient;
}

As for the "new", I don't really see the problem since "new Stuff()"
in haXe will translate to "new Stuff()" anyway.
What errors do you have exactly ?

Cheers,
Clément

On Thu, Oct 13, 2011 at 12:37 AM, sledorze <[hidden email]> wrote:

> The code is extracted from the facebook sample app for node.js.
>
> The problem is really related to the js use of 'new' that does not translate
> in haxe 'new'.
>
>
> the 'require' method is a NodeJs method that loads a js module; in this
> case; it's the facebook one.
>
> here's the related file:
> https://github.com/DracoBlue/node-facebook-client/blob/master/lib/facebook-client/FacebookClient.js
>
> My code (the sample code) only uses the getSessionByAccessToken function of
> the prototype you may find in this file.
>
> I think my post title is misleading as there no constructors involved
> actually, it would just be a way to lure haxe in order to generate the
> awaited javascript code..
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886992.html
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

sledorze
FacebookClient is NOT a class, it's a prototype and IS DOES NOT exists at compile time; it's built AT RUNTIME..
even require cannot be called at compile time.. (we're in a dynamic context here..)

On Thu, Oct 13, 2011 at 10:12 AM, clemos [via Haxe] <[hidden email]> wrote:
See how the JQuery extern is inited :
http://code.google.com/p/haxe/source/browse/trunk/std/js/JQuery.hx#310

In your FaceBookClient class, you should be able to this to
include/require the file:
private static function __init__(){
  var lib : Dynamic = untyped require('facebook-client');
  FaceBookClient = lib.FaceBookClient;
}

As for the "new", I don't really see the problem since "new Stuff()"
in haXe will translate to "new Stuff()" anyway.
What errors do you have exactly ?

Cheers,
Clément

On Thu, Oct 13, 2011 at 12:37 AM, sledorze <[hidden email]> wrote:

> The code is extracted from the facebook sample app for node.js.
>
> The problem is really related to the js use of 'new' that does not translate
> in haxe 'new'.
>
>
> the 'require' method is a NodeJs method that loads a js module; in this
> case; it's the facebook one.
>
> here's the related file:
> https://github.com/DracoBlue/node-facebook-client/blob/master/lib/facebook-client/FacebookClient.js
>
> My code (the sample code) only uses the getSessionByAccessToken function of
> the prototype you may find in this file.
>
> I think my post title is misleading as there no constructors involved
> actually, it would just be a way to lure haxe in order to generate the
> awaited javascript code..
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886992.html

> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org



If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6888028.html
To unsubscribe from Constructor .. How would you define that as an extern????, click here.



--
Stéphane Le Dorze


Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

sledorze
In reply to this post by clemos
oh, I forgot a smiley :)
upper case letters are for meaning, nothing else.. !

thanks for helping!
Stephane

On Thu, Oct 13, 2011 at 10:17 AM, Stephane Le Dorze <[hidden email]> wrote:
FacebookClient is NOT a class, it's a prototype and IS DOES NOT exists at compile time; it's built AT RUNTIME..
even require cannot be called at compile time.. (we're in a dynamic context here..)


On Thu, Oct 13, 2011 at 10:12 AM, clemos [via Haxe] <[hidden email]> wrote:
See how the JQuery extern is inited :
http://code.google.com/p/haxe/source/browse/trunk/std/js/JQuery.hx#310

In your FaceBookClient class, you should be able to this to
include/require the file:
private static function __init__(){
  var lib : Dynamic = untyped require('facebook-client');
  FaceBookClient = lib.FaceBookClient;
}

As for the "new", I don't really see the problem since "new Stuff()"
in haXe will translate to "new Stuff()" anyway.
What errors do you have exactly ?

Cheers,
Clément

On Thu, Oct 13, 2011 at 12:37 AM, sledorze <[hidden email]> wrote:

> The code is extracted from the facebook sample app for node.js.
>
> The problem is really related to the js use of 'new' that does not translate
> in haxe 'new'.
>
>
> the 'require' method is a NodeJs method that loads a js module; in this
> case; it's the facebook one.
>
> here's the related file:
> https://github.com/DracoBlue/node-facebook-client/blob/master/lib/facebook-client/FacebookClient.js
>
> My code (the sample code) only uses the getSessionByAccessToken function of
> the prototype you may find in this file.
>
> I think my post title is misleading as there no constructors involved
> actually, it would just be a way to lure haxe in order to generate the
> awaited javascript code..
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886992.html

> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org



If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6888028.html
To unsubscribe from Constructor .. How would you define that as an extern????, click here.



--
Stéphane Le Dorze


Tel: <a href="tel:%2B33%20%280%29%206%2008%20%C2%A076%2070%2015" value="+33608767015" target="_blank">+33 (0) 6 08  76 70 15





--
Stéphane Le Dorze


Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

clemos
In reply to this post by sledorze
I'm sorry but I think I don't get it.

Extern classes are actually made to make runtime classes
available/understandable "at compile time".
The __init__ and other functions you can declare in these classes must
be understood as "glue code" that help haXe code conform to the
runtime platform.

Even though the FacebookClient prototype is "created" at runtime (like
anything in JS, anyway...), and haXe doesn't understand what
"require()" is at compile time, AFAIK the code I wrote should at least
generate JS code that will run well in an environnement where
"require()" exists and where FacebookClient is anything you can
instanciate with "new".
To be clear: it should generate more or less the exact same code as in
your first post.

But then again, I'd like to hear more precisely what compile-time
and/or runtime errors you get when trying to use this approach...

Clément

On Thu, Oct 13, 2011 at 10:17 AM, sledorze <[hidden email]> wrote:

> FacebookClient is NOT a class, it's a prototype and IS DOES NOT exists at
> compile time; it's built AT RUNTIME..
> even require cannot be called at compile time.. (we're in a dynamic context
> here..)
>
> On Thu, Oct 13, 2011 at 10:12 AM, clemos [via Haxe] <[hidden email]> wrote:
>>
>> See how the JQuery extern is inited :
>> http://code.google.com/p/haxe/source/browse/trunk/std/js/JQuery.hx#310
>>
>> In your FaceBookClient class, you should be able to this to
>> include/require the file:
>> private static function __init__(){
>>   var lib : Dynamic = untyped require('facebook-client');
>>   FaceBookClient = lib.FaceBookClient;
>> }
>>
>> As for the "new", I don't really see the problem since "new Stuff()"
>> in haXe will translate to "new Stuff()" anyway.
>> What errors do you have exactly ?
>>
>> Cheers,
>> Clément
>>
>> On Thu, Oct 13, 2011 at 12:37 AM, sledorze <[hidden email]> wrote:
>> > The code is extracted from the facebook sample app for node.js.
>> >
>> > The problem is really related to the js use of 'new' that does not
>> > translate
>> > in haxe 'new'.
>> >
>> >
>> > the 'require' method is a NodeJs method that loads a js module; in this
>> > case; it's the facebook one.
>> >
>> > here's the related file:
>> >
>> > https://github.com/DracoBlue/node-facebook-client/blob/master/lib/facebook-client/FacebookClient.js
>> >
>> > My code (the sample code) only uses the getSessionByAccessToken function
>> > of
>> > the prototype you may find in this file.
>> >
>> > I think my post title is misleading as there no constructors involved
>> > actually, it would just be a way to lure haxe in order to generate the
>> > awaited javascript code..
>> >
>> > --
>> > View this message in context:
>> > http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886992.html
>> > Sent from the Haxe mailing list archive at Nabble.com.
>> >
>> > --
>> > haXe - an open source web programming language
>> > http://haxe.org
>> >
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6888028.html
>> To unsubscribe from Constructor .. How would you define that as an
>> extern????, click here.
>
>
> --
> Stéphane Le Dorze
> http://lambdabrella.blogspot.com/
> http://www.linkedin.com/in/stephaneledorze
> http://twitter.com/stephaneledorze
> Tel: +33 (0) 6 08  76 70 15
>
>
> ________________________________
> View this message in context: Re: Constructor .. How would you define that
> as an extern????
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

sledorze
In reply to this post by clemos
I really don't know what you're proposing..
Let me put here some code based on what I understood from your input  (that does not compile)

definition:

extern
class FacebookClient {
public function getSessionByAccessToken(access_token : Dynamic) : (FacebookSession -> Void) -> Void; //  not relevant for out example

private static function __init__() : Void { 
 var lib : Dynamic = js.Node.require('facebook-client');
 FacebookClient = lib.FaceBookClient;  // <<<<<<<<<<<<<<<<<< here's an invalid assignment..
}
}

user code:

var facebook = new FacebookClient();




On Thu, Oct 13, 2011 at 10:12 AM, clemos [via Haxe] <[hidden email]> wrote:
See how the JQuery extern is inited :
http://code.google.com/p/haxe/source/browse/trunk/std/js/JQuery.hx#310

In your FaceBookClient class, you should be able to this to
include/require the file:
private static function __init__(){
  var lib : Dynamic = untyped require('facebook-client');
  FaceBookClient = lib.FaceBookClient;
}

As for the "new", I don't really see the problem since "new Stuff()"
in haXe will translate to "new Stuff()" anyway.
What errors do you have exactly ?

Cheers,
Clément

On Thu, Oct 13, 2011 at 12:37 AM, sledorze <[hidden email]> wrote:

> The code is extracted from the facebook sample app for node.js.
>
> The problem is really related to the js use of 'new' that does not translate
> in haxe 'new'.
>
>
> the 'require' method is a NodeJs method that loads a js module; in this
> case; it's the facebook one.
>
> here's the related file:
> https://github.com/DracoBlue/node-facebook-client/blob/master/lib/facebook-client/FacebookClient.js
>
> My code (the sample code) only uses the getSessionByAccessToken function of
> the prototype you may find in this file.
>
> I think my post title is misleading as there no constructors involved
> actually, it would just be a way to lure haxe in order to generate the
> awaited javascript code..
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886992.html

> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org



If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6888028.html
To unsubscribe from Constructor .. How would you define that as an extern????, click here.



--
Stéphane Le Dorze


Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

clemos
Hi Stephane,

It was quickly wrote :)

The whole __init__ block should be untyped:
private static function __init__() : Void untyped {

You'll have to add the constructor signature:
public function new():Void;

Then you *should* be able to use it in your application :
var fc = new FacebookClient();
fc.getSessionByAccessToken( /* whatever callback function */ );

Cheers,
Clément

On Thu, Oct 13, 2011 at 11:10 AM, sledorze <[hidden email]> wrote:

> I really don't know what you're proposing..
> Let me put here some code based on what I understood from your input  (that
> does not compile)
>
> definition:
> extern
> class FacebookClient {
> public function getSessionByAccessToken(access_token : Dynamic) :
> (FacebookSession -> Void) -> Void; //  not relevant for out example
> private static function __init__() : Void {
>  var lib : Dynamic = js.Node.require('facebook-client');
>  FacebookClient = lib.FaceBookClient;  // <<<<<<<<<<<<<<<<<< here's an
> invalid assignment..
> }
> }
> user code:
> var facebook = new FacebookClient();
>
>
>
> On Thu, Oct 13, 2011 at 10:12 AM, clemos [via Haxe] <[hidden email]> wrote:
>>
>> See how the JQuery extern is inited :
>> http://code.google.com/p/haxe/source/browse/trunk/std/js/JQuery.hx#310
>>
>> In your FaceBookClient class, you should be able to this to
>> include/require the file:
>> private static function __init__(){
>>   var lib : Dynamic = untyped require('facebook-client');
>>   FaceBookClient = lib.FaceBookClient;
>> }
>>
>> As for the "new", I don't really see the problem since "new Stuff()"
>> in haXe will translate to "new Stuff()" anyway.
>> What errors do you have exactly ?
>>
>> Cheers,
>> Clément
>>
>> On Thu, Oct 13, 2011 at 12:37 AM, sledorze <[hidden email]> wrote:
>> > The code is extracted from the facebook sample app for node.js.
>> >
>> > The problem is really related to the js use of 'new' that does not
>> > translate
>> > in haxe 'new'.
>> >
>> >
>> > the 'require' method is a NodeJs method that loads a js module; in this
>> > case; it's the facebook one.
>> >
>> > here's the related file:
>> >
>> > https://github.com/DracoBlue/node-facebook-client/blob/master/lib/facebook-client/FacebookClient.js
>> >
>> > My code (the sample code) only uses the getSessionByAccessToken function
>> > of
>> > the prototype you may find in this file.
>> >
>> > I think my post title is misleading as there no constructors involved
>> > actually, it would just be a way to lure haxe in order to generate the
>> > awaited javascript code..
>> >
>> > --
>> > View this message in context:
>> > http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886992.html
>> > Sent from the Haxe mailing list archive at Nabble.com.
>> >
>> > --
>> > haXe - an open source web programming language
>> > http://haxe.org
>> >
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6888028.html
>> To unsubscribe from Constructor .. How would you define that as an
>> extern????, click here.
>
>
> --
> Stéphane Le Dorze
> http://lambdabrella.blogspot.com/
> http://www.linkedin.com/in/stephaneledorze
> http://twitter.com/stephaneledorze
> Tel: +33 (0) 6 08  76 70 15
>
>
> ________________________________
> View this message in context: Re: Constructor .. How would you define that
> as an extern????
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Constructor .. How would you define that as an extern????

sledorze
Thanks for insisting; it makes more sense now it works :p

Just realized I am still not used to the possibilities untyped provides with the JS backend; good learning! :)


Here's the working solution :

@:native("FacebookClient") // <<<<<<<<<<<< this was needed in order to not have a namespace clash (otherwise js.node.FacebookClient)
extern
class FacebookClient {
public function getSessionByAccessToken(access_token : Dynamic) : (FacebookSession -> Void) -> Void;
public function new():Void; 

private static function __init__() : Void untyped { 
 FacebookClient = Node.require('facebook-client').FacebookClient; 
}
}

user code:

var facebook = new FacebookClient();

facebook.getSessionByAccessToken( ...


Cool, I'll update the signatures (I've added several new (partials) externs including Express, FacebookClient, NodeUuid, SocketIo)  and make a pullrequest to Dion.. ;)

Thanks!
Stéphane

On Thu, Oct 13, 2011 at 11:24 AM, clemos [via Haxe] <[hidden email]> wrote:
Hi Stephane,

It was quickly wrote :)

The whole __init__ block should be untyped:
private static function __init__() : Void untyped {

You'll have to add the constructor signature:
public function new():Void;

Then you *should* be able to use it in your application :
var fc = new FacebookClient();
fc.getSessionByAccessToken( /* whatever callback function */ );

Cheers,
Clément

On Thu, Oct 13, 2011 at 11:10 AM, sledorze <[hidden email]> wrote:

> I really don't know what you're proposing..
> Let me put here some code based on what I understood from your input  (that
> does not compile)
>
> definition:
> extern
> class FacebookClient {
> public function getSessionByAccessToken(access_token : Dynamic) :
> (FacebookSession -> Void) -> Void; //  not relevant for out example
> private static function __init__() : Void {
>  var lib : Dynamic = js.Node.require('facebook-client');
>  FacebookClient = lib.FaceBookClient;  // <<<<<<<<<<<<<<<<<< here's an
> invalid assignment..
> }
> }
> user code:
> var facebook = new FacebookClient();
>
>
>
> On Thu, Oct 13, 2011 at 10:12 AM, clemos [via Haxe] <[hidden email]> wrote:

>>
>> See how the JQuery extern is inited :
>> http://code.google.com/p/haxe/source/browse/trunk/std/js/JQuery.hx#310
>>
>> In your FaceBookClient class, you should be able to this to
>> include/require the file:
>> private static function __init__(){
>>   var lib : Dynamic = untyped require('facebook-client');
>>   FaceBookClient = lib.FaceBookClient;
>> }
>>
>> As for the "new", I don't really see the problem since "new Stuff()"
>> in haXe will translate to "new Stuff()" anyway.
>> What errors do you have exactly ?
>>
>> Cheers,
>> Clément
>>
>> On Thu, Oct 13, 2011 at 12:37 AM, sledorze <[hidden email]> wrote:
>> > The code is extracted from the facebook sample app for node.js.
>> >
>> > The problem is really related to the js use of 'new' that does not
>> > translate
>> > in haxe 'new'.
>> >
>> >
>> > the 'require' method is a NodeJs method that loads a js module; in this
>> > case; it's the facebook one.
>> >
>> > here's the related file:
>> >
>> > https://github.com/DracoBlue/node-facebook-client/blob/master/lib/facebook-client/FacebookClient.js
>> >

>> > My code (the sample code) only uses the getSessionByAccessToken function
>> > of
>> > the prototype you may find in this file.
>> >
>> > I think my post title is misleading as there no constructors involved
>> > actually, it would just be a way to lure haxe in order to generate the
>> > awaited javascript code..
>> >
>> > --
>> > View this message in context:
>> > http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6886992.html
>> > Sent from the Haxe mailing list archive at Nabble.com.

>> >
>> > --
>> > haXe - an open source web programming language
>> > http://haxe.org
>> >
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6888028.html
>> To unsubscribe from Constructor .. How would you define that as an
>> extern????, click here.
>
>
> --
> Stéphane Le Dorze
> http://lambdabrella.blogspot.com/
> http://www.linkedin.com/in/stephaneledorze
> http://twitter.com/stephaneledorze
> Tel: <a href="tel:%2B33%20%280%29%206%2008%20%C2%A076%2070%2015" value="+33608767015" target="_blank">+33 (0) 6 08  76 70 15
>
>
> ________________________________
> View this message in context: Re: Constructor .. How would you define that
> as an extern????
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org



If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/Constructor-How-would-you-define-that-as-an-extern-tp6885347p6888242.html
To unsubscribe from Constructor .. How would you define that as an extern????, click here.



--
Stéphane Le Dorze