Root of the hierarchy of JavaScript types.
Arrays are list-like objects whose prototype has methods to perform traversal and mutation operations.
Equivalent of scm.ArrayOps
for js.Array.
Stores the JS constructor function of a JS class.
Creates a JavaScript Date instance that represents a single moment in time.
Dictionary "view" of a JavaScript value.
Dynamically typed JavaScript value.
An instance representing an error that occurs regarding the global function
eval()
.
The Function constructor creates a new Function object.
ECMAScript 6 JavaScript Iterable.
Adapts a JavaScript Iterable to a Scala Iterable
ECMAScript 6 JavaScript Iterator.
Discouraged native JavaScript Array methods.
Operations on JavaScript numbers.
Operations on JavaScript strings.
Base class of all JavaScript objects.
ECMAScript 6 Promise of an asynchronous result.
An instance representing an error that occurs when a numeric variable or parameter is outside of its valid range.
Represents an error when a non-existent variable is referenced.
The RegExp constructor creates a regular expression object for matching text with a pattern.
ECMAScript 6 JavaScript Symbol.
Represents an error when trying to interpret syntactically invalid code.
A thing on which one can call the then
method.
A JavaScript function where this
is considered as a first parameter.
A tuple "view" of 2 elements of a JavaScript js.Array.
A tuple "view" of 3 elements of a JavaScript js.Array.
Represents an error when a value is not of the expected type.
Represents an error when a malformed URI is encountered.
Value of type A or the JS undefined value.
Value of type A or the JS undefined value.
This type is actually strictly equivalent to A | Unit
, since Unit
is
the type of the undefined
value.
js.UndefOr[A]
is the type of a value that can be either undefined
or
an A
. It provides an API similar to that of scala.Option through
the UndefOrOps implicit class, where undefined
take the role of
None.
By extension, this type is also suited to typing optional fields in native JS types, i.e., fields that may not exist on the object.
A Unicode Normalization Form.
Equivalent of scm.WrappedArray
for js.Array.
Wrapper to use a js.
Marks the annotated class, trait or object as a native JS entity.
Value of type A or B (union type).
Provides implicit conversions from Scala values to JavaScript values.
Factory for js.Array objects.
Factory for js.Date objects.
Factory for js.Dictionary instances.
Factory for dynamically typed JavaScript values.
Provides implicit conversions and operations to write in JavaScript style with js.Dynamic.
A collection of decorators that allow converting Scala types to corresponding JS facade types
The JSON object contains methods for converting values to JavaScript Object Notation (JSON) and for converting JSON to values.
Math is a built-in object that has properties and methods for mathematical constants and functions.
The top-level Object
JavaScript object.
ECMAScript 6 Factory for js.Symbols and well-known symbols.
Methods related to URIs, provided by ECMAScript 5.
Factory for js.WrappedArray.
Returns the constructor function of a JavaScript class.
Returns the constructor function of a JavaScript class.
The specified type parameter T
must be a class type (i.e., valid for
classOf[T]
) and represent a class extending js.Any
(not a trait nor
an object).
Makes explicit an implicitly available js.ConstructorTag.
Evaluates JavaScript code and returns the result.
Evaluates JavaScript code and returns the result.
Tests whether the given value is undefined.
Tests whether the given value is undefined.
Denotes a method body as native JavaScript.
Denotes a method body as native JavaScript. For use in facade types:
class MyJSClass extends js.Object { def myMethod(x: String): Int = js.native }
Non-Standard Non-standard, but in general well supported methods to schedule asynchronous execution.
Returns the type of x
as identified by typeof x
in JavaScript.
ECMAScript 6 The typdearray package provides facade types for JavaScript ArrayBuffer, TypeArrays and DataView.
The undefined value.
The undefined value.
Types, methods and values for interoperability with JavaScript libraries.
This package is only relevant to the Scala.js compiler, and should not be referenced by any project compiled to the JVM.
Guide
General documentation on Scala.js is available at http://www.scala-js.org/doc/.
Overview
The trait js.Any is the root of the hierarchy of JavaScript types. This package defines important subtypes of js.Any that are defined in the standard library of ECMAScript 5.1 (or ES 6, with a label in the documentation), such as js.Object, js.Array and js.RegExp.
Implicit conversions to and from standard Scala types to their equivalent in JavaScript are provided. For example, from Scala functions to JavaScript functions and back.
The most important subtypes of js.Any declared in this package are:
this
as an explicit parameterThe trait js.Dynamic is a special subtrait of js.Any. It can represent any JavaScript value in a dynamically-typed way. It is possible to call any method and read and write any field of a value of type js.Dynamic.
There are no explicit definitions for JavaScript primitive types, as one could expect, because the corresponding Scala types stand in their stead:
null
)Null
is the type of the JavaScript null valuejs.UndefOr gives a scala.Option-like interface where the JavaScript value
undefined
takes the role ofNone
.A | B is an unboxed pseudo-union type, suitable to type values that admit several unrelated types in facade types.