Package kotlin.js
Functions and other APIs specific to the JavaScript platform.
Types
Console
Exposes the console API to Kotlin.
interface ConsoleJsClass
Represents the constructor of a class. Instances of JsClass can be passed to JavaScript APIs that expect a constructor reference.
interface JsClass<T : Any>JSON
Exposes the JavaScript JSON object to Kotlin.
object JSONMath
Exposes the JavaScript Math object to Kotlin.
object MathPromise
Exposes the JavaScript Promise object to Kotlin.
open class Promise<out T>RegExp
Exposes the JavaScript RegExp object to Kotlin.
class RegExpRegExpMatch
Represents the return value of RegExp.exec.
interface RegExpMatchAnnotations
ExperimentalJsExport
Marks experimental JS export annotations.
annotation class ExperimentalJsExportJsExport
Exports top-level declaration.
annotation class JsExportJsModule
Denotes an external declaration that must be imported from native JavaScript library.
annotation class JsModuleJsName
Gives a declaration (a function, a property or a class) specific name in JavaScript.
annotation class JsNameJsNonModule
Denotes an external declaration that can be used without module system.
annotation class JsNonModuleJsQualifier
Adds prefix to external declarations in a source file.
annotation class JsQualifiernative
annotation class nativenativeGetter
annotation class nativeGetternativeInvoke
annotation class nativeInvokenativeSetter
annotation class nativeSetterProperties
console
Exposes the console API to Kotlin.
val console: ConsoledefinedExternally
The property that can be used as a placeholder for statements and values that are defined in JavaScript.
val definedExternally: Nothingundefined
Exposes the JavaScript undefined property to Kotlin.
val undefined: Nothing?Functions
asArray
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.
fun RegExpMatch.asArray(): Array<out String?>asDynamic
Reinterprets this value as a value of the dynamic type.
fun Any?.asDynamic(): dynamicdateLocaleOptions
fun dateLocaleOptions(
init: LocaleOptions.() -> Unit
): LocaleOptionseval
Exposes the JavaScript eval function to Kotlin.
fun eval(expr: String): dynamicget
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.
operator fun RegExpMatch.get(index: Int): String?iterator
Allows to iterate this dynamic object in the following cases:
operator fun dynamic.iterator(): Iterator<dynamic>js
fun js(code: String): dynamicjsTypeOf
Function corresponding to JavaScript's typeof operator
fun jsTypeOf(a: Any?): StringparseFloat
fun parseFloat(
s: String,
radix: Int = definedExternally
): DoubleparseInt
fun parseInt(s: String): Intfun parseInt(s: String, radix: Int = definedExternally): Intreset
Resets the regular expression so that subsequent RegExp.test and RegExp.exec calls will match starting with the beginning of the input string.
fun RegExp.reset()unsafeCast
Reinterprets this value as a value of the specified type T without any actual type checking.
fun <T> Any?.unsafeCast(): T