Marks the annotated class or object as being a member of the JavaScript
global scope.
The annotated class/object must also be annotated with @js.native, and
therefore extend js.Any.
Given:
@js.native
@JSGlobal
class Foo extends js.Object
@js.native
@JSGlobal("Foobar")
object Bar extends js.Object
@js.native
@JSGlobal("Lib.Babar")
class Babar extends js.Object
The following mappings apply (global denotes the global scope):
Scala.js | JavaScript
------------------------+------------------
new Foo() | new global.Foo()
Bar | global.Foobar
js.constructorOf[Babar] | global.Lib.Babar
This member is added by an implicit conversion from JSGlobal to
StringAdd performed by method any2stringadd in scala.Predef.
Shadowing
This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error. To access this member you can use a type ascription:
This member is added by an implicit conversion from JSGlobal to
StringFormat performed by method any2stringfmt in scala.Predef.
Shadowing
This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error. To access this member you can use a type ascription:
This member is added by an implicit conversion from JSGlobal to
ArrowAssoc[JSGlobal] performed by method any2ArrowAssoc in scala.Predef.
Shadowing
This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error. To access this member you can use a type ascription:
This member is added by an implicit conversion from JSGlobal to
Ensuring[JSGlobal] performed by method any2Ensuring in scala.Predef.
Shadowing
This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error. To access this member you can use a type ascription:
(jSGlobal: Ensuring[JSGlobal]).x
Definition Classes
Ensuring
Annotations
@deprecated
Deprecated
(Since version 2.10.0) Use resultOfEnsuring instead
Marks the annotated class or object as being a member of the JavaScript global scope.
The annotated class/object must also be annotated with
@js.native
, and therefore extend js.Any.Given:
The following mappings apply (
global
denotes the global scope):Calling JavaScript from Scala.js