Package-level declarations

Functions and other APIs specific to the JavaScript platform.

Functions and other APIs specific to the JavaScript platform.

Types

Link copied to clipboard
external interface Console

Exposes the console API to Kotlin.

Since Kotlin 1.1
Link copied to clipboard
external class Date

Exposes the Date API to Kotlin.

Since Kotlin 1.1
Link copied to clipboard
annotation class ExperimentalJsExport

Marks experimental JS export annotations.

Since Kotlin 1.4
Link copied to clipboard
external interface JsClass<T : Any>

Represents the constructor of a class. Instances of JsClass can be passed to JavaScript APIs that expect a constructor reference.

Since Kotlin 1.1
Link copied to clipboard

Exports top-level declaration on JS platform.

Since Kotlin 1.4

Exports top-level declaration on JS platform.

Since Kotlin 1.3
Link copied to clipboard

Denotes an external declaration that must be imported from native JavaScript library.

Since Kotlin 1.1
Link copied to clipboard

Gives a declaration (a function, a property or a class) specific name in JavaScript.

Since Kotlin 1.0

Gives a declaration (a function, a property or a class) specific name in JavaScript.

Since Kotlin 1.1
Link copied to clipboard

Denotes an external declaration that can be used without module system.

Since Kotlin 1.1
Link copied to clipboard
external object JSON

Exposes the JavaScript JSON object to Kotlin.

Since Kotlin 1.1
Link copied to clipboard
external interface Json

An interface for indexing access to a collection of key-value pairs, where type of key is String and type of value is Any?.

Since Kotlin 1.1
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class JsQualifier(val value: String)

Adds prefix to external declarations in a source file.

Since Kotlin 1.1
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class nativeGetter
Since Kotlin 1.1
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class nativeInvoke
Since Kotlin 1.1
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class nativeSetter
Since Kotlin 1.1
Link copied to clipboard
open external class Promise<out T>(executor: (resolve: (T) -> Unit, reject: (Throwable) -> Unit) -> Unit)

Exposes the JavaScript Promise object to Kotlin.

Since Kotlin 1.1
Link copied to clipboard
external class RegExp(pattern: String, flags: String? = definedExternally)

Exposes the JavaScript RegExp object to Kotlin.

Since Kotlin 1.1
Link copied to clipboard
external interface RegExpMatch

Represents the return value of RegExp.exec.

Since Kotlin 1.1

Properties

Link copied to clipboard
external val console: Console

Exposes the console API to Kotlin.

Since Kotlin 1.1
Link copied to clipboard

The property that can be used as a placeholder for statements and values that are defined in JavaScript.

Since Kotlin 1.1
Link copied to clipboard
val <T : Any> KClass<T>.js: JsClass<T>

Obtains a constructor reference for the given KClass.

Since Kotlin 1.1
Link copied to clipboard
val <T : Any> JsClass<T>.kotlin: KClass<T>

Obtains a KClass instance for the given constructor reference.

Since Kotlin 1.1
Link copied to clipboard
external val noImpl: Nothing
Since Kotlin 1.1
Link copied to clipboard
external val undefined: Nothing?

Exposes the JavaScript undefined property to Kotlin.

Since Kotlin 1.1

Functions

Link copied to clipboard
fun Json.add(other: Json): Json

Adds key-value pairs from other to this. Returns the original receiver.

Since Kotlin 1.1
Link copied to clipboard
inline fun RegExpMatch.asArray(): Array<out String?>

Converts the result of RegExp.exec to an array where the first element contains the entire matched text and each subsequent element is the text matched by each capturing parenthesis.

Since Kotlin 1.1
Link copied to clipboard
inline fun Any?.asDynamic(): dynamic

Reinterprets this value as a value of the /docs/reference/dynamic-type.html.

Since Kotlin 1.1
Link copied to clipboard
Since Kotlin 1.1
Link copied to clipboard
external fun eval(expr: String): dynamic

Exposes the JavaScript eval function to Kotlin.

Since Kotlin 1.1
Link copied to clipboard
inline operator fun RegExpMatch.get(index: Int): String?

Returns the entire text matched by RegExp.exec if the index parameter is 0, or the text matched by the capturing parenthesis at the given index.

Since Kotlin 1.1
Link copied to clipboard
operator fun dynamic.iterator(): Iterator<dynamic>

Allows to iterate this dynamic object in the following cases:

Since Kotlin 1.1
Link copied to clipboard
external fun js(code: String): dynamic

Puts the given piece of a JavaScript code right into the calling function. The compiler replaces call to js(...) code with the string constant provided as a parameter.

Since Kotlin 1.1
Link copied to clipboard
fun json(vararg pairs: Pair<String, Any?>): Json

Returns a simple JavaScript object (as Json) using provided key-value pairs as names and values of its properties.

Since Kotlin 1.1
Link copied to clipboard
inline fun jsTypeOf(a: Any?): String

Function corresponding to JavaScript's typeof operator

Since Kotlin 1.1
Link copied to clipboard
external fun parseFloat(s: String, radix: Int = definedExternally): Double
Since Kotlin 1.1
Link copied to clipboard
external fun parseInt(s: String): Int
external fun parseInt(s: String, radix: Int = definedExternally): Int
Since Kotlin 1.1
Link copied to clipboard

Resets the regular expression so that subsequent RegExp.test and RegExp.exec calls will match starting with the beginning of the input string.

Since Kotlin 1.1
Link copied to clipboard
inline fun <T, S> Promise<Promise<T>>.then(noinline onFulfilled: (T) -> S?): Promise<S>
inline fun <T, S> Promise<Promise<T>>.then(noinline onFulfilled: (T) -> S?, noinline onRejected: (Throwable) -> S?): Promise<S>
Since Kotlin 1.1
Link copied to clipboard
inline fun <T> dynamic.unsafeCast(): T

Reinterprets this dynamic value as a value of the specified type T without any actual type checking.

Since Kotlin 1.1
inline fun <T> Any?.unsafeCast(): T

Reinterprets this value as a value of the specified type T without any actual type checking.

Since Kotlin 1.1