Skip to content

Commit 5777037

Browse files
committed
update readme
1 parent 1654d3f commit 5777037

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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
4959
More examples can be found in the [sample directory](sample).

0 commit comments

Comments
 (0)