scala

scalajs

package scalajs

Visibility
  1. Public
  2. All

Value Members

  1. package concurrent

  2. package js

    Types, methods and values for interoperability with JavaScript libraries.

    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 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 functions to JavaScript functions 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.

    There are no explicit definitions for JavaScript primitive types, as one could expect, because the corresponding Scala types stand in their stead:

    • Boolean is a primitive JavaScript boolean
    • Double is a primitive JavaScript number
    • String is a primitive JavaScript string
    • Unit is the type of the JavaScript undefined value
    • Null is the type of the JavaScript null value

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

  3. package niocharset

  4. package runtime

Ungrouped