Package

scala.scalajs.js

annotation

Permalink

package annotation

Visibility
  1. Public
  2. All

Type Members

  1. class ExposedJSMember extends Annotation with StaticAnnotation

    Permalink

    IMPLEMENTATION DETAIL: Marks the annotated member as exposed as a JS member.

    IMPLEMENTATION DETAIL: Marks the annotated member as exposed as a JS member.

    This annotation is added automatically by the compiler to all public and protected members of a Scala.js-defined JS class. It marks the annotated member as being exposed as a JS member.

    Do not use this annotation yourself.

  2. class JSBracketAccess extends Annotation with StaticAnnotation

    Permalink

    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

  3. class JSBracketCall extends Annotation with StaticAnnotation

    Permalink

    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

  4. class JSExport extends Annotation with StaticAnnotation

    Permalink

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

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

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

    Export Scala.js APIs to JavaScript

  5. class JSExportAll extends Annotation with StaticAnnotation

    Permalink

    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

  6. class JSExportDescendentClasses extends Annotation with StaticAnnotation

    Permalink

    Specifies that all the concrete classes extending the annotated class or should have all their public constructors exported for use in raw JS.

    Specifies that all the concrete classes extending the annotated class or should have all their public constructors exported for use in raw JS. The constructors exported this way are exported under their fully qualified name.

    See also

    Export Scala.js APIs to JavaScript

  7. class JSExportDescendentObjects extends Annotation with StaticAnnotation

    Permalink

    Specifies that all the objects extending the annotated class or trait should be exported for use in raw JS.

    Specifies that all the objects extending the annotated class or trait should be exported for use in raw JS. Note that objects exported this way are exported under their fully qualified name.

    See also

    Export Scala.js APIs to JavaScript

  8. class JSExportStatic extends Annotation with StaticAnnotation

    Permalink

    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 Scala.js-defined JavaScript class. The annotated member will be available as a static member of the companion class.

    See also

    Write JavaScript classes in Scala.js

    Export Scala.js APIs to JavaScript

  9. class JSExportTopLevel extends Annotation with StaticAnnotation

    Permalink

    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

  10. class JSGlobal extends Annotation with StaticAnnotation

    Permalink

    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
    See also

    Calling JavaScript from Scala.js

  11. class JSGlobalScope extends Annotation with StaticAnnotation

    Permalink

    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

  12. class JSImport extends Annotation with StaticAnnotation

    Permalink

    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.

  13. class JSName extends Annotation with StaticAnnotation

    Permalink

    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

  14. class JavaDefaultMethod extends Annotation with StaticAnnotation

    Permalink

    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.

  15. class RawJSType extends Annotation with StaticAnnotation

    Permalink

    Marks the annotated class, trait or object as a raw JavaScript type.

    Marks the annotated class, trait or object as a raw JavaScript type.

    This annotation is added automatically by the compiler to all classes, traits and objects inheriting directly or indirectly from scala.scalajs.js.Any. It marks the annotated entity as being a raw JavaScript type, i.e., one that represents type information for an entity defined in JavaScript code.

    Do not use this annotation yourself.

  16. class SJSDefinedAnonymousClass extends Annotation

    Permalink

    IMPLEMENTATION DETAIL: Marks anonymous Scala.js-defined JS classes.

    IMPLEMENTATION DETAIL: Marks anonymous Scala.js-defined JS classes.

    This annotation is added automatically by the compiler to Scala.js defined anonymous classes.

    Do not use this annotation yourself.

  17. class ScalaJSDefined extends Annotation with StaticAnnotation

    Permalink

    Marks the annotated class as a Scala.js-defined JavaScript class.

    Marks the annotated class as a Scala.js-defined JavaScript class.

    This annotation may only be used on a class extending js.Any.

  18. class WasPublicBeforeTyper extends Annotation

    Permalink

    IMPLEMENTATION DETAIL: Marks public members of anonymous classes before typer.

    IMPLEMENTATION DETAIL: Marks public members of anonymous classes before typer.

    This annotation is added automatically by the compiler to all public members of anonymous classes.

    Do not use this annotation yourself.

  19. class JSExportNamed extends Annotation with StaticAnnotation

    Permalink

    Exports the given method to JavaScript with named parameters.

    Exports the given method to JavaScript with named parameters.

    It can then be called like this:

    obj.foo({
      param1: value1
      param2: value2
      param7: value3
    });

    Note that named exports don't support overloading. Therefore the following will fail:

    class A {
      @JSExportNamed
      def a(foo: Int) = foo + 1
      @JSExportNamed
      def a(bar: String) = "Hello " + bar
    }

    As of Scala.js 0.6.11, @JSExportNamed is deprecated without direct replacement (see https://github.com/scala-js/scala-js/issues/2442). You should take a single parameter of a JS type and decompose it yourself. For example, instead of

    class A {
      @JSExportNamed
      def foo(a: Int, b: String, c: Boolean = false): Unit = {
        // do something with a, b, c
      }
    }

    you should write:

    trait FooOptions extends js.Object {
      val a: Int
      val b: String
      val c: js.UndefOr[Boolean]
    }
    
    class A {
      @JSExport
      def foo(options: FooOptions): Unit = {
        val a = options.a
        val b = options.b
        val c = options.c.getOrElse(false)
        // do something with a, b, c
      }
    }
    Annotations
    @deprecated
    Deprecated

    (Since version 0.6.11)

    See also

    Export Scala.js APIs to JavaScript

  20. class JSFullName extends Annotation with StaticAnnotation

    Permalink

    IMPLEMENTATION DETAIL: Saves the fully qualified JS name of a symbol.

    IMPLEMENTATION DETAIL: Saves the fully qualified JS name of a symbol.

    This annotation was used prior to Scala.js 0.6.13. It is only kept for backwards binary compatibility, and should not be used anymore.

    Do not use this annotation yourself.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.6.13) Replaced by internal.JSNativeLoadSpec.

Value Members

  1. object JSImport

    Permalink

Ungrouped