JSFuture

cps.monads.jsfuture.JSFuture
See theJSFuture companion object
class JSFuture[T](val executorOrUndef: UndefOr[Function2[Function1[T | Thenable[T], _], Function1[Any, _], _]], val futureOrUndef: UndefOr[Future[T]]) extends Promise[T]

JSFuture is a class, which can be represented on the js-side as a JSPromise and on the scala side - as a Future.

   @JSExportTopLevel("FromScalaExample")
   object FromScalaExample:

       @JSExport
       def myFunction(x: String): JSFuture[String] = async[JSFuture] {
            .....
       }

I.e. in the example above we can use FromScalaExample.myFunction("x") as JS-function which return ps.Promise and inside async use usual async/await monadic API.

Attributes

Companion
object
Source
JSFuture.scala
Graph
Supertypes
class Promise[T]
trait Thenable[T]
class Object
trait Any
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def flatMap[S](f: T => JSFuture[S]): JSFuture[S]

Attributes

Source
JSFuture.scala
def flatMapTry[S](f: Try[T] => JSFuture[S]): JSFuture[S]

Attributes

Source
JSFuture.scala
def map[S](f: T => S): JSFuture[S]

Attributes

Source
JSFuture.scala
def mapTry[S](f: Try[T] => S): JSFuture[S]

Attributes

Source
JSFuture.scala

Inherited methods

def `catch`[B >: T](onRejected: UndefOr[Function1[Any, B | Thenable[B]]]): Promise[B]

Attributes

Inherited from:
Promise
def `then`[B >: T](onFulfilled: Unit, onRejected: UndefOr[Function1[Any, B | Thenable[B]]]): Promise[B]

Attributes

Inherited from:
Promise
def `then`[B](onFulfilled: Function1[T, B | Thenable[B]], onRejected: UndefOr[Function1[Any, B | Thenable[B]]]): Promise[B]

Attributes

Inherited from:
Promise
def hasOwnProperty(v: String): Boolean

Attributes

Inherited from:
Object
def isPrototypeOf(v: Object): Boolean

Attributes

Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean

Attributes

Inherited from:
Object
def toLocaleString(): String

Attributes

Inherited from:
Object
def valueOf(): Any

Attributes

Inherited from:
Object

Concrete fields

val executorOrUndef: UndefOr[Function2[Function1[T | Thenable[T], _], Function1[Any, _], _]]

Attributes

Source
JSFuture.scala
lazy val future: Future[T]

Attributes

Source
JSFuture.scala
val futureOrUndef: UndefOr[Future[T]]

Attributes

Source
JSFuture.scala