Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geokaralis/jscore
A Javascript runtime through v8 for android, sharing code between web and mobile.
https://github.com/geokaralis/jscore
android bindings cpp java javascript kotlin mobile v8 vm
Last synced: 22 days ago
JSON representation
A Javascript runtime through v8 for android, sharing code between web and mobile.
- Host: GitHub
- URL: https://github.com/geokaralis/jscore
- Owner: geokaralis
- License: apache-2.0
- Created: 2019-02-13T10:03:32.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-04T11:44:37.000Z (almost 6 years ago)
- Last Synced: 2024-11-13T08:37:12.352Z (3 months ago)
- Topics: android, bindings, cpp, java, javascript, kotlin, mobile, v8, vm
- Language: C
- Homepage:
- Size: 82.4 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JSCore
JSCore is an android library for running javascript inside java. It's main purpose is for code sharing between web and mobile. In it's core it uses google's v8 javascript runtime library. One main characteristic of JSCore is the concept of javascript bindings within java/kotlin, making the js library feel more like a native one.## Usage
```kotlin
class Underscore(private val src: String): JSObject() {
// Bind Underscore.js's contains function to Kotlin for integers
fun contains(list: ArrayList, index: Int): Boolean {
return JSObject().bind(src).function("contains", arrayListOf(list, index))
}
}
```
```kotlin
val list: ArrayList = ArrayList()
list.add(1)
list.add(2)
list.add(3)val underscore = Underscore(src)
val contains = underscore.contains(list, 3) // true
```
JSCore also evaluates scripts as per the usual way.
```java
JSContext ctx = new JSContext(); // Javascript VM contextString greeting = (String) ctx.evaluate(""
+ "var message = 'hello world!'"
+ "message.toUpperCase();");
Log.d("Greeting", greeting); // HELLO WORLD!
```
## v8
v8 is used as JSCore's javascript runtime environment.## Kotlin
JSCore is written entirely in Kotlin.## Contributing
JSCore is still at the early alpha stages of architecting and c++ support through ndk. If you 'd like to contribute to this project feel free to pull request and provide ideas through issues.## LICENSE
Copyright (c) 2019, George Karalis.Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.