scala

scalajs

package scalajs

Visibility
  1. Public
  2. All

Value Members

  1. package concurrent

  2. package js

    Contains primitive types for interoperability with JavaScript libraries.

    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://www.scala-js.org/doc/.

    Overview

    The trait js.Any is the super type of all JavaScript values.

    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.

    Implicit conversions to and from standard Scala types to their equivalent in JavaScript are provided. For example, from Scala arrays to JavaScript arrays and back.

    The most important subclasses of js.Any are:

    • js.Dynamic, a dynamically typed interface to JavaScript APIs
    • js.Object, the superclass of all statically typed JavaScript classes, which has subclasses for all the classes standardized in ECMAScript 5.1, among which:

    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 package scala.scalajs.js.prim gives definition for the four primitive types of JavaScript as subtraits of js.Any, but generally it is preferable to use the corresponding Scala type.

    js.UndefOr gives a scala.Option-like interface where the JavaScript value undefined takes the role of None.

  3. package runtime

Ungrouped