js.Lib.alert missing?

109 views
Skip to first unread message

Peter Stefcek

unread,
Mar 18, 2013, 11:52:46 AM3/18/13
to haxe...@googlegroups.com
Hi there guys, in haxe 3 there is no js.Lib anymore according to the migration document but some methods are missing like js.Lib.alert how can we alert exceptions in js target in haxe 3 now?

Thanks.

postite

unread,
Mar 18, 2013, 12:00:55 PM3/18/13
to haxe...@googlegroups.com
I can see js.Lib ine the haxe 3 source code here 

if you refer to this 

it's just saying that some properties (like document ) have been moved to js.html ..
but i guess js.lib still exists !
did you try ?

Le lundi 18 mars 2013 à 16:52, Peter Stefcek a écrit :

Hi there guys, in haxe 3 there is no js.Lib anymore according to the migration document but some methods are missing like js.Lib.alert how can we alert exceptions in js target in haxe 3 now?

Thanks.

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Peter Stefcek

unread,
Mar 18, 2013, 12:03:13 PM3/18/13
to haxe...@googlegroups.com, al...@postite.com
Yep I did try there is no js.Lib there is only js.Browser and js.html.*

postite

unread,
Mar 18, 2013, 12:16:06 PM3/18/13
to haxe...@googlegroups.com
weirdo  !!
did you check your std files ?

clemos

unread,
Mar 18, 2013, 12:24:37 PM3/18/13
to haxe...@googlegroups.com
It's weird indeed...
Otherwise, it's available as Browser.window.alert() 
...which IMHO makes more sense.
At least one of them should be removed to avoid duplication...

Regards,
Clément

david quertelet

unread,
Mar 18, 2013, 12:28:51 PM3/18/13
to haxe...@googlegroups.com
hello Clemos !
About that ! 
because i'm nor ready to upgrade to haxe 3 ,
i often check tryhaxe.org , hoping t will use haxe3, for tests.
do you plan to do that ?

Peter Stefcek

unread,
Mar 18, 2013, 12:43:23 PM3/18/13
to haxe...@googlegroups.com
Ok got it working it was FlashDevelop acting up on me, but you are absolutely right clemos I will rather use Browser.window.alert

clemos

unread,
Mar 18, 2013, 2:30:34 PM3/18/13
to haxe...@googlegroups.com
Hi David,

There already exists an Haxe3-ready version of try-haxe, thanks to @profelis: 
This version can only be compiled using haxe 3, and can only compile code to haxe 3.

I didn't upgrade to haxe 3 on my local machine yet, due to some haxe 2 projects I want to finish first, so I can't really contribute to this version yet.
I also wanted to wait for the official release (and consequent library updates) to upgrade my server to haxe 3 as well.

Regards,
Clément

Bruno Garcia

unread,
Mar 18, 2013, 4:35:50 PM3/18/13
to haxe...@googlegroups.com
On 03/18/2013 09:43 AM, Peter Stefcek wrote:
> Ok got it working it was FlashDevelop acting up on me, but you are
> absolutely right clemos I will rather use Browser.window.alert

...would anyone mind if Lib.alert was removed? It would be nice to keep
js.Lib slim and without browser dependencies.

We could move it to Browser, but alert is not commonly used these days,
so I think the shortcut method is questionable. trace() to the console
is so much better for debugging.

Bruno

Peter Stefcek

unread,
Mar 18, 2013, 4:44:29 PM3/18/13
to haxe...@googlegroups.com, b...@aduros.com
I personally don't mind, I have a question though since I am pretty new to this is there a better way to throw an error than a simple trace like you suggest? I want to stop execution like throw new Error in AS3 does. It would also help if it got somewhat highlighted in dev tools like google console etc a simple trace is easy to overlook especially if execution continues.

Thanks

clemos

unread,
Mar 18, 2013, 5:10:55 PM3/18/13
to haxe...@googlegroups.com
In Haxe, you can actually throw anything: http://haxe.org/doc/cross/exceptions
Uncaught exceptions should stop script execution and display as errors in the console.
I'm not sure the call stack shows up there, but maybe.

Apparently, there is also js.Lib.debug() to create a debugger breakpoint.

Regards,
Clément


--
Reply all
Reply to author
Forward
0 new messages