NativeConverter

@implicitNotFound("Could not find an implicit NativeConverter[${A}]") trait NativeConverter[A]

Typeclass for converting between Scala.js and native JavaScript.

Type Params
A

the type to convert

Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def fromNative(nativeJs: Any): A

Convert a native Javascript type to Scala.js. <br> Any RuntimeException subclass may be thrown if conversion fails.

Convert a native Javascript type to Scala.js. <br> Any RuntimeException subclass may be thrown if conversion fails.

Concrete methods

def fromJson(json: String): A

Convert a Json String to type A <br> Any RuntimeException subclass may be thrown if conversion fails.

Convert a Json String to type A <br> Any RuntimeException subclass may be thrown if conversion fails.

Extensions

Extensions

extension (a: A)
def toJson: String

Convert type A to a JSON string <br> Any RuntimeException subclass may be thrown if conversion fails.

Convert type A to a JSON string <br> Any RuntimeException subclass may be thrown if conversion fails.

def toNative: Any

Convert a Scala.js type to native JavaScript. <br> This is an extension method, so it's available on all types that derive NativeConverter. To use for other types, like Int, summon a NativeConverter and use: NativeConverter[Int].toNative(123) <br> Any RuntimeException subclass may be thrown if conversion fails.

Convert a Scala.js type to native JavaScript. <br> This is an extension method, so it's available on all types that derive NativeConverter. To use for other types, like Int, summon a NativeConverter and use: NativeConverter[Int].toNative(123) <br> Any RuntimeException subclass may be thrown if conversion fails.