File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 1- [ ![ GitHub license] ( https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat )] ( http://www.apache.org/licenses/LICENSE-2.0 ) [ ![ Download] ( https://api.bintray.com/packages/icerockdev/ moko/moko- javascript/images/download.svg ) ] ( https://bintray.com/icerockdev/moko/ moko-javascript/_latestVersion ) ![ kotlin-version] ( https://img.shields.io/badge/kotlin-1.4.32-orange )
1+ [ ![ GitHub license] ( https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat )] ( http://www.apache.org/licenses/LICENSE-2.0 ) [ ![ Download] ( https://img.shields.io/maven-central/v/dev.icerock. moko/javascript ) ] ( https://repo1.maven.org/maven2/dev/icerock/ moko/javascript ) ![ kotlin-version] ( https://img.shields.io/badge/kotlin-1.4.32-orange )
22
33# Mobile Kotlin javascript
4- This is a Kotlin MultiPlatform library that ...
4+ This is a Kotlin MultiPlatform library that allows you to run JavaScript code from common Kotlin code
55
66## Table of Contents
77- [ Features] ( #features )
@@ -14,7 +14,8 @@ This is a Kotlin MultiPlatform library that ...
1414- [ License] ( #license )
1515
1616## Features
17- ...
17+ - Evaluate JavaScript code from Kotlin common code
18+ - Pass objects to JavaScript as global vars
1819
1920## Requirements
2021- Gradle version 6.0+
@@ -43,7 +44,16 @@ dependencies {
4344```
4445
4546## Usage
46- ...
47+ ``` kotlin
48+ val javaScriptEngine = JavaScriptEngine ()
49+ val result: JsType = javaScriptEngine.evaluate(
50+ context = emptyMap(),
51+ script = """ "Hello" + "World" """ .trimIndent()
52+ )
53+ if (result is JsType .Str ) {
54+ println (result.value)
55+ }
56+ ```
4757
4858## Samples
4959More examples can be found in the [ sample directory] ( sample ) .
You can’t perform that action at this time.
0 commit comments