scala.scalajs

js

package js

Contains primitive types 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.

All the values and methods in this package object are representatives of standard variables and functions available in the top-level scope, as standardized in ECMAScript 5.1.

Guide

General documentation on Scala.js can is available at http://lampwww.epfl.ch/~doeraene/scala-js/doc/.

Overview

The trait js.Any is the super type of all JavaScript values. It has subtraits js.Number, js.Boolean, js.String and js.Undefined which represent values of primitive JavaScript types. It also has a subclass js.Object, which is the base class of all JavaScript objects, and represents the predefined Object class of JavaScript.

All class, trait and object definitions that inherit, directly or indirectly, from js.Any do not have actual implementations in Scala. They are only the manifestation of static types representing libraries written directly in JavaScript. It is not possible to implement yourself a subclass of js.Any: all the method definitions will be ignored when compiling to JavaScript.

The 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.

The trait js.Dictionary provides read and write access to any field of any JavaScript value with the array access syntax of Scala, mapping to the array access syntax of JavaScript.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. js
  2. GlobalScope
  3. Object
  4. Any
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait Any extends AnyRef

    Super-type of all JavaScript values.

  2. class Array[A] extends Object

    Arrays are list-like objects whose prototype has methods to perform traversal and mutation operations.

  3. sealed trait Boolean extends Any

    Primitive JavaScript boolean.

  4. class Date extends Object

    Creates a JavaScript Date instance that represents a single moment in time.

  5. sealed trait Dictionary[A] extends Object

    Dictionary "view" of a JavaScript value.

  6. sealed trait Dynamic extends Any with scala.Dynamic

    Dynamically typed JavaScript value.

  7. class Error extends Object

    Annotations
    @RawJSType()
  8. class EvalError extends Error

    An instance representing an error that occurs regarding the global function eval()

  9. class Function extends Object

    The Function constructor creates a new Function object.

  10. trait Function0[+R] extends Function

    Annotations
    @RawJSType()
  11. trait Function1[-T1, +R] extends Function

    Annotations
    @RawJSType()
  12. trait Function10[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, +R] extends Function

    Annotations
    @RawJSType()
  13. trait Function11[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, +R] extends Function

    Annotations
    @RawJSType()
  14. trait Function12[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, +R] extends Function

    Annotations
    @RawJSType()
  15. trait Function13[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, +R] extends Function

    Annotations
    @RawJSType()
  16. trait Function14[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, +R] extends Function

    Annotations
    @RawJSType()
  17. trait Function15[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, +R] extends Function

    Annotations
    @RawJSType()
  18. trait Function16[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, +R] extends Function

    Annotations
    @RawJSType()
  19. trait Function17[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, +R] extends Function

    Annotations
    @RawJSType()
  20. trait Function18[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, +R] extends Function

    Annotations
    @RawJSType()
  21. trait Function19[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, +R] extends Function

    Annotations
    @RawJSType()
  22. trait Function2[-T1, -T2, +R] extends Function

    Annotations
    @RawJSType()
  23. trait Function20[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, +R] extends Function

    Annotations
    @RawJSType()
  24. trait Function21[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, +R] extends Function

    Annotations
    @RawJSType()
  25. trait Function22[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, -T22, +R] extends Function

    Annotations
    @RawJSType()
  26. trait Function3[-T1, -T2, -T3, +R] extends Function

    Annotations
    @RawJSType()
  27. trait Function4[-T1, -T2, -T3, -T4, +R] extends Function

    Annotations
    @RawJSType()
  28. trait Function5[-T1, -T2, -T3, -T4, -T5, +R] extends Function

    Annotations
    @RawJSType()
  29. trait Function6[-T1, -T2, -T3, -T4, -T5, -T6, +R] extends Function

    Annotations
    @RawJSType()
  30. trait Function7[-T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends Function

    Annotations
    @RawJSType()
  31. trait Function8[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends Function

    Annotations
    @RawJSType()
  32. trait Function9[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, +R] extends Function

    Annotations
    @RawJSType()
  33. trait GlobalScope extends Object

    Marker trait for top-level objects representing the JS global scope.

  34. trait JSApp extends AnyRef

    Annotations
    @JSExportDescendentObjects()
  35. case class JavaScriptException(exception: Any) extends RuntimeException with Product with Serializable

  36. sealed trait Number extends Any

    Primitive JavaScript number.

  37. class Object extends Any

    Base class of all JavaScript objects.

  38. trait PropertyDescriptor extends Object

    Annotations
    @RawJSType()
  39. class RangeError extends Error

    An instance representing an error that occurs when a numeric variable or parameter is outside of its valid range.

  40. class ReferenceError extends Error

    Represents an error when a non-existent variable is referenced.

  41. class RegExp extends Object

    The RegExp constructor creates a regular expression object for matching text with a pattern.

  42. sealed trait String extends Any

    Primitive JavaScript string.

  43. class SyntaxError extends Error

    Represents an error when trying to interpret syntactically invalid code.

  44. trait ThisFunction extends Function

    A JavaScript function where this is considered as a first parameter.

  45. trait ThisFunction0[-T0, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  46. trait ThisFunction1[-T0, -T1, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  47. trait ThisFunction10[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  48. trait ThisFunction11[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  49. trait ThisFunction12[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  50. trait ThisFunction13[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  51. trait ThisFunction14[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  52. trait ThisFunction15[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  53. trait ThisFunction16[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  54. trait ThisFunction17[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  55. trait ThisFunction18[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  56. trait ThisFunction19[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  57. trait ThisFunction2[-T0, -T1, -T2, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  58. trait ThisFunction20[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  59. trait ThisFunction21[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  60. trait ThisFunction3[-T0, -T1, -T2, -T3, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  61. trait ThisFunction4[-T0, -T1, -T2, -T3, -T4, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  62. trait ThisFunction5[-T0, -T1, -T2, -T3, -T4, -T5, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  63. trait ThisFunction6[-T0, -T1, -T2, -T3, -T4, -T5, -T6, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  64. trait ThisFunction7[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  65. trait ThisFunction8[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  66. trait ThisFunction9[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, +R] extends Function with ThisFunction

    Annotations
    @RawJSType()
  67. class TypeError extends Error

    Represents an error when a value is not of the expected type.

  68. class URIError extends Error

    Represents an error when a malformed URI is encountered.

  69. sealed trait Undefined extends Any

    Primitive JavaScript undefined value.

Value Members

  1. def +(that: String): String

    Definition Classes
    Any
  2. object Any

    Provides implicit conversions from Scala values to JavaScript values.

  3. object Array extends Object

    Factory for js.Array objects.

  4. object Boolean extends Object

    The top-level Boolean JavaScript object.

  5. object Date extends Object

    Factory for js.Date objects.

  6. object Dictionary

    Factory for Dictionary instances.

  7. object Dynamic

    Factory for dynamically typed JavaScript values.

  8. object Error extends Object

  9. object EvalError extends Object

  10. object Function extends Object

  11. val Infinity: Number

    The constant Positive Infinity.

  12. object JSON extends Object

    The JSON object contains methods for converting values to JavaScript Object Notation (JSON) and for converting JSON to values.

  13. object Math extends Object

    Math is a built-in object that has properties and methods for mathematical constants and functions.

  14. val NaN: Number

    The constant Not-a-Number.

  15. object Number extends Object

    The top-level Number JavaScript object

  16. object Object extends Object

    The top-level Object JavaScript object.

  17. object RangeError extends Object

  18. object ReferenceError extends Object

  19. object RegExp extends Object

  20. object String extends Object

    The top-level String JavaScript object.

  21. object SyntaxError extends Object

  22. object ThisFunction

  23. object TypeError extends Object

  24. object URIError extends Object

  25. package annotation

  26. def debugger(): Unit

    Invokes any available debugging functionality.

    Invokes any available debugging functionality. If no debugging functionality is available, this statement has no effect.

    MDN

    Browser support: * Has no effect in Rhino nor, apparently, in Firefox * In Chrome, it has no effect unless the developer tools are opened beforehand.

  27. def decodeURI(encodedURI: String): String

    Decodes a Uniform Resource Identifier (URI).

    Decodes a Uniform Resource Identifier (URI).

    See also

    encodeURI

  28. def decodeURIComponent(encodedURIComponent: String): String

    Decodes a Uniform Resource Identifier (URI) component.

    Decodes a Uniform Resource Identifier (URI) component.

    See also

    encodeURIComponent

  29. def encodeURI(uri: String): String

    Encodes a Uniform Resource Identifier (URI).

    Encodes a Uniform Resource Identifier (URI).

    See also

    decodeURI

  30. def encodeURIComponent(uriComponent: String): String

    Encodes a Uniform Resource Identifier (URI) component.

    Encodes a Uniform Resource Identifier (URI) component.

    See also

    decodeURIComponent

  31. def eval(x: String): Any

    Evaluates JavaScript code and returns the result.

  32. def hasOwnProperty(v: String): Boolean

    Every object descended from Object inherits the hasOwnProperty method.

    Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object's prototype chain.

    MDN

    Definition Classes
    Object
  33. def isFinite(number: Number): Boolean

    Tests whether the given value is a finite number.

  34. def isNaN(number: Number): Boolean

    Tests whether the given value is Not-a-Number.

  35. def isPrototypeOf(v: Object): Boolean

    The isPrototypeOf mehtod allows you to check whether or not an object exists within another object's prototype chain.

    The isPrototypeOf mehtod allows you to check whether or not an object exists within another object's prototype chain.

    MDN

    Definition Classes
    Object
  36. def parseFloat(string: String): Number

    Parses a string as a floating point number.

  37. def parseInt(s: String): Number

    Parses a string as an integer with auto-detected radix.

  38. def parseInt(s: String, radix: Number): Number

    Parses a string as an integer with a given radix.

  39. def propertyIsEnumerable(v: String): Boolean

    Every object has a propertyIsEnumerable method.

    Every object has a propertyIsEnumerable method. This method can determine whether the specified property in an object can be enumerated by a for...in loop, with the exception of properties inherited through the prototype chain. If the object does not have the specified property, this method returns false.

    MDN

    Definition Classes
    Object
  40. def toLocaleString(): String

    Definition Classes
    Object
  41. def typeOf(x: Any): String

    Returns the type of x as identified by typeof x in JavaScript.

  42. def unary_!(): Boolean

    Definition Classes
    Any
  43. def valueOf(): Any

    Definition Classes
    Object

Inherited from GlobalScope

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from scala.Any

Ungrouped