W3cubDocs

/Haxe JavaScript

Lib

package js

Available on js

Platform-specific JavaScript Library. Provides some platform-specific functions for the JavaScript target.

Static variables

static read only global:Dynamic

An alias of the JS "global" object.

Concretely, it is set as the first defined value in the list of window, global, self, and this in the top-level of the compiled output.

static read only nativeThis:Dynamic

nativeThis is the JavaScript this, which is semantically different from the Haxe this. Use nativeThis only when working with external JavaScript code.

In Haxe, this is always bound to a class instance. In JavaScript, this in a function can be bound to an arbitrary variable when the function is called using func.call(thisObj, ...) or func.apply(thisObj, [...]).

Read more at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this

static read only undefined:Dynamic

Returns JavaScript undefined value.

Note that this is only needed in very rare cases when working with external JavaScript code.

In Haxe, null is used to represent the absence of a value.

Static methods

@:has_untyped static alert (v:Dynamic):Void

Deprecated: "Lib.alert() is deprecated, use Browser.alert() instead"
Deprecated: Use Browser.alert() instead.

Display an alert message box containing the given message.

@:has_untyped static inline debug ():Void

Inserts a 'debugger' statement that will make a breakpoint if a debugger is available.

@:has_untyped static inline eval (code:String):Dynamic

@:has_untyped @:extern static inline require (module:String):Dynamic

Inserts a require expression that loads JavaScript object from a module or file specified in the module argument.

This is only supported in environments where require function is available, such as Node.js or RequireJS.

@:has_untyped @:extern static inline rethrow ():Void

Re-throw last cathed exception, preserving original stack information.

Calling this only makes sense inside a catch statement.

© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/Lib.html