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
  • 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
  • RawTimers
  • SetIntervalHandle
  • SetTimeoutHandle
  • 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

package timers

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.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. timers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait SetIntervalHandle extends Any

    Non-Standard A handle returned from a call to setInterval.

    Non-Standard A handle returned from a call to setInterval.

    May only be used to pass to clearInterval.

    Annotations
    @JSType()
  2. sealed trait SetTimeoutHandle extends Any

    Non-Standard A handle returned from a call to setTimeout.

    Non-Standard A handle returned from a call to setTimeout.

    May only be used to pass to clearTimeout.

    Annotations
    @JSType()

Value Members

  1. def clearInterval(handle: SetIntervalHandle): Unit

    Cancel an interval execution

    Cancel an interval execution

    handle

    The handle returned by setInterval.

    Note

    Uses JavaScript's non-standard clearInterval

  2. def clearTimeout(handle: SetTimeoutHandle): Unit

    Cancel a timeout execution

    Cancel a timeout execution

    handle

    The handle returned by setTimeout.

    Note

    Uses JavaScript's non-standard clearTimeout

  3. def setInterval(interval: FiniteDuration)(body: ⇒ Unit): SetIntervalHandle

    Schedule something for repeated execution every duration.

    Schedule something for repeated execution every duration.

    interval

    duration between executions

    body

    code to execute after each interval

    returns

    A handle that can be used to cancel the interval by passing it to clearInterval.

    Note

    Uses JavaScript's non-standard setInterval

  4. def setInterval(interval: Double)(body: ⇒ Unit): SetIntervalHandle

    Schedule something for repeated execution every interval milliseconds.

    Schedule something for repeated execution every interval milliseconds.

    interval

    duration in milliseconds between executions

    body

    code to execute after each interval

    returns

    A handle that can be used to cancel the interval by passing it to clearInterval.

    Note

    Uses JavaScript's non-standard setInterval

  5. def setTimeout(interval: FiniteDuration)(body: ⇒ Unit): SetTimeoutHandle

    Schedule something for execution after a duration.

    Schedule something for execution after a duration.

    interval

    duration to wait

    body

    code to execute after interval has passed

    returns

    A handle that can be used to cancel the timeout by passing it to clearTimeout.

    Note

    Uses JavaScript's non-standard setTimeout

  6. def setTimeout(interval: Double)(body: ⇒ Unit): SetTimeoutHandle

    Schedule something for execution in interval milliseconds.

    Schedule something for execution in interval milliseconds.

    interval

    duration in milliseconds to wait

    body

    code to execute after interval has passed

    returns

    A handle that can be used to cancel the timeout by passing it to clearTimeout.

    Note

    Uses JavaScript's non-standard setTimeout

  7. object RawTimers extends Object

    Non-Standard Raw JavaScript timer methods.

    Non-Standard Raw JavaScript timer methods.

    The methods on this object expose the raw JavaScript methods for timers. In general it is more advisable to use the methods directly defined on timers as they are more Scala-like.

    Annotations
    @native() @JSGlobalScope()

Inherited from AnyRef

Inherited from scala.Any

Ungrouped