Packages

  • package root
    Definition Classes
    root
  • package scala
    Definition Classes
    root
  • package scalajs
    Definition Classes
    scala
  • 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 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:

    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 the type of primitive JavaScript booleans
    • Double is the type of primitive JavaScript numbers
    • String is the type of primitive JavaScript strings (or null)
    • 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.

    A | B is an unboxed pseudo-union type, suitable to type values that admit several unrelated types in facade types.

    Definition Classes
    scalajs
  • package annotation
    Definition Classes
    js
  • JSBracketAccess
  • JSBracketCall
  • JSExport
  • JSExportAll
  • JSExportStatic
  • JSExportTopLevel
  • JSGlobal
  • JSGlobalScope
  • JSImport
  • JSName
  • JavaDefaultMethod
  • package timers

    Non-Standard Non-standard, but in general well supported methods to schedule asynchronous execution.

    Non-Standard Non-standard, but in general well supported methods to schedule asynchronous execution.

    The methods in this package work in all JavaScript virtual machines supporting setTimeout and setInterval.

    Definition Classes
    js
  • package typedarray

    ECMAScript 6 The typdearray package provides facade types for JavaScript ArrayBuffer, TypeArrays and DataView.

    ECMAScript 6 The typdearray package provides facade types for JavaScript ArrayBuffer, TypeArrays and DataView. Further, it provides conversions between primitive Scala arrays and TypedArrays

    Definition Classes
    js
p

scala.scalajs.js

annotation

package annotation

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. class JSBracketAccess extends Annotation with StaticAnnotation

    Marks the annotated method as representing bracket access in JavaScript.

    Marks the annotated method as representing bracket access in JavaScript.

    See also

    Calling JavaScript from Scala.js

  2. class JSBracketCall extends Annotation with StaticAnnotation

    Marks the annotated method as representing bracket call in JavaScript.

    Marks the annotated method as representing bracket call in JavaScript.

    See also

    Calling JavaScript from Scala.js

  3. class JSExport extends Annotation with StaticAnnotation

    Specifies that the given entity should be exported for use in JS.

    Specifies that the given entity should be exported for use in JS.

    Annotations
    @field() @getter() @setter()
    See also

    Export Scala.js APIs to JavaScript

  4. class JSExportAll extends Annotation with StaticAnnotation

    Exports all public members directly defined in a class / object.

    Exports all public members directly defined in a class / object.

    Strictly equivalent to putting JSExport on every public member. Note: You are allowed to export protected members, but you'll have to do this explicitly on each member.

    See also

    Export Scala.js APIs to JavaScript

  5. class JSExportStatic extends Annotation with StaticAnnotation

    Specifies that the annotated member should be exported as a JavaScript static member of the companion class.

    Specifies that the annotated member should be exported as a JavaScript static member of the companion class.

    This annotation may only be used on members of a Scala object whose companion class is a non-native JS class. The annotated member will be available as a static member of the companion class.

    Annotations
    @field() @getter() @setter()
    See also

    Export Scala.js APIs to JavaScript

    Write JavaScript classes in Scala.js

  6. class JSExportTopLevel extends Annotation with StaticAnnotation

    Specifies that the given member should be exported to the top level of the module.

    Specifies that the given member should be exported to the top level of the module.

    Annotations
    @field() @getter() @setter()
    See also

    Export Scala.js APIs to JavaScript

  7. class JSGlobal extends Annotation with StaticAnnotation

    Marks the annotated class or object as being a member of the JavaScript global scope.

    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
    Annotations
    @field() @getter() @setter()
    See also

    Calling JavaScript from Scala.js

  8. class JSGlobalScope extends Annotation with StaticAnnotation

    Marks the annotated object as representing the JavaScript global scope.

    Marks the annotated object as representing the JavaScript global scope.

    This is particularly useful to model top-level functions and fields that are in the JavaScript global scope. They can be declared inside an object annotated with @JSGlobalScope.

    See also

    Calling JavaScript from Scala.js

  9. class JSImport extends Annotation with StaticAnnotation

    Marks the annotated class or object as imported from another JS module.

    Marks the annotated class or object as imported from another JS module.

    Intuitively, this corresponds to ECMAScript import directives. See the documentation of the various constructors.

    @JSImport is not compatible with the jsDependencies mechanism offered by the Scala.js sbt plugin. You are responsible for resolving and/or bundling the JavaScript modules that you are importing using other mechanisms.

    Annotations
    @field() @getter() @setter()
  10. class JSName extends Annotation with StaticAnnotation

    Specifies the JavaScript name of an entity.

    Specifies the JavaScript name of an entity.

    Annotations
    @field() @getter() @setter()
    See also

    Calling JavaScript from Scala.js

  11. class JavaDefaultMethod extends Annotation with StaticAnnotation

    Mark a concrete trait method as a Java default method.

    Mark a concrete trait method as a Java default method.

    This annotation can be used on concrete trait methods to mark them as Java default methods. This should be used *only* to implement interfaces of the JDK that have default methods in Java.

    Otherwise using this annotation is unspecified.

Value Members

  1. object JSImport

Ungrouped