Class/Object

org.scalajs.linker.interface

ESFeatures

Related Docs: object ESFeatures | package interface

Permalink

final class ESFeatures extends AnyRef

ECMAScript features to use when linking to JavaScript.

The options in ESFeatures specify what features of modern versions of JavaScript are used by the Scala.js linker.

As of Scala.js 1.6.0, the setting useECMAScriptSemantics2015 is derived from esVersion. In the future, it might become independently configurable.

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

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val allowBigIntsForLongs: Boolean

    Permalink

    EXPERIMENTAL: Primitive Longs *may* be compiled as primitive JavaScript bigints.

    EXPERIMENTAL: Primitive Longs *may* be compiled as primitive JavaScript bigints.

    Default: false

    Future versions of Scala.js may decide to ignore this setting.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val avoidClasses: Boolean

    Permalink

    Avoid class'es when using functions and prototypes has the same observable semantics.

    Avoid class'es when using functions and prototypes has the same observable semantics.

    Default: true

    SpiderMonkey is known to exhibit terrible performance with JavaScript class'es, with up to an order of magnitude of performance degradation.

    Setting this option to true provides a hint to the Scala.js linker to avoid using class'es when using other JavaScript features (typically functions and prototypes) has the same observable semantics, in order to improve expected performance. Setting it to false provides a hint not to avoid class'es. Either way, the linker is free to ignore this option.

    Avoiding class'es has a negative impact on code size. If the code is only targeted at engines that are known to have good performance with class'es, it is desirable to set this option to false. If the code is targeted at browsers (among others), it is recommended to set it to true.

    This option never affects the code emitted for JavaScript classes (classes extending js.Any), since that would have an impact on observable semantics.

    This option is always ignored when esVersion < ESVersion.ES2015.

  7. val avoidLetsAndConsts: Boolean

    Permalink

    Avoid lets and consts when using vars has the same observable semantics.

    Avoid lets and consts when using vars has the same observable semantics.

    Default: true

    Due to their semantics in JavaScript (their Temporal Dead Zone, TDZ), lets and consts are more difficult for engines to optimize than vars. There have been known cases of dramatic performance issues with them, such as the Webkit issue https://bugs.webkit.org/show_bug.cgi?id=199866.

    Setting this option to true provides a hint to the Scala.js linker to avoid using them when using a var has the same observable semantics, in order to improve expected performance. Setting it to false provides a hint not to avoid lets and consts. Either way, the linker is free to ignore this option.

    Using lets and consts has benefits for humans writing code as they help readability and debugging, but there is little to no benefit in using them when the code is compiler-generated.

    This option is always ignored when esVersion < ESVersion.ES2015.

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(that: Any): Boolean

    Permalink
    Definition Classes
    ESFeatures → AnyRef → Any
  11. val esVersion: ESVersion

    Permalink

    The ECMAScript version that is assumed to be supported by the runtime.

    The ECMAScript version that is assumed to be supported by the runtime.

    Default: ESVersion.ES2015

    The linker and the libraries may use this value to:

    • provide more features that rely on recent ECMAScript language features, and/or
    • dead-code-eliminate away polyfills.

    Prefer reading this value over useECMAScript2015Semantics to perform feature tests.

  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    ESFeatures → AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    ESFeatures → AnyRef → Any
  21. val useECMAScript2015Semantics: Boolean

    Permalink

    Use the ECMAScript 2015 semantics of Scala.js language features.

    Use the ECMAScript 2015 semantics of Scala.js language features.

    Default: true

    As of Scala.js 1.6.0, this is true if and only if esVersion >= ESVersion.ES2015. In the future, it might become independently configurable.

    When true, the following behaviors are guaranteed:

    • JavaScript classes are true class'es, therefore a) they can extend native JavaScript class'es and b) they inherit static members from their parent class.
    • Lambdas for js.Functions that are not also js.ThisFunctions are JavaScript arrow functions (=>). Lambdas for js.ThisFunctions are function functions.
    • Throwable classes are proper JavaScript error classes, recognized as such by debuggers.
    • In Script (NoModule) mode, top-level exports are defined as lets.

    When false, the following behaviors apply instead:

    • All classes defined in Scala.js are functions instead of class'es. Non-native JS classes cannot extend native JS class'es and they do not inherit static members from their parent class.
    • All lambdas for js.Functions are functions.
    • Throwable classes have JavaScript's Error.prototype in their prototype chain, but they are not considered proper error classes.
    • In Script (NoModule) mode, top-level exports are defined as vars.

    Prefer reading this value instead of esVersion to determine which semantics apply. Doing so will be future-proof if and when this setting becomes configurable independently from esVersion.

  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. def withAllowBigIntsForLongs(allowBigIntsForLongs: Boolean): ESFeatures

    Permalink
  26. def withAvoidClasses(avoidClasses: Boolean): ESFeatures

    Permalink
  27. def withAvoidLetsAndConsts(avoidLetsAndConsts: Boolean): ESFeatures

    Permalink
  28. def withESVersion(esVersion: ESVersion): ESFeatures

    Permalink

Deprecated Value Members

  1. val useECMAScript2015: Boolean

    Permalink

    Use ECMAScript 2015 features.

    Use ECMAScript 2015 features.

    Prefer reading esVersion or useECMAScript2015Semantics instead, depending on the use case.

    This is always equal to useECMAScript2015Semantics.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.6.0) use esVersion or useECMAScript2015Semantics instead

  2. def withUseECMAScript2015(useECMAScript2015: Boolean): ESFeatures

    Permalink

    Specifies whether the linker should use ECMAScript 2015 features.

    Specifies whether the linker should use ECMAScript 2015 features.

    If false, this method sets the esVersion to ESVersion.ES5_1. Otherwise, if esVersion was below ES2015, it sets it to ES2015. Otherwise, it returns the same configuration of ESFeatures.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.6.0) use withESVersion(ESVersion.ES5_1) or withESVersion(ESVersion.ES2015) instead

Inherited from AnyRef

Inherited from Any

Ungrouped