{"id":24623256,"url":"https://github.com/paulcoding810/js","last_synced_at":"2026-02-12T21:30:51.922Z","repository":{"id":273319702,"uuid":"919249219","full_name":"paulcoding810/js","owner":"paulcoding810","description":"Android JavaScript Library","archived":false,"fork":false,"pushed_at":"2025-03-04T04:09:11.000Z","size":134,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T04:03:17.809Z","etag":null,"topics":["android","js","kotlin","rhino"],"latest_commit_sha":null,"homepage":"https://central.sonatype.com/artifact/com.paulcoding/js","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulcoding810.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-20T03:28:15.000Z","updated_at":"2025-03-04T04:09:14.000Z","dependencies_parsed_at":"2025-01-20T07:37:05.781Z","dependency_job_id":"4d1aa9c8-0ed9-4261-9b17-0c399ef6f615","html_url":"https://github.com/paulcoding810/js","commit_stats":null,"previous_names":["paulcoding810/js"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/paulcoding810/js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulcoding810%2Fjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulcoding810%2Fjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulcoding810%2Fjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulcoding810%2Fjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulcoding810","download_url":"https://codeload.github.com/paulcoding810/js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulcoding810%2Fjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29381742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T20:34:40.886Z","status":"ssl_error","status_checked_at":"2026-02-12T20:23:00.490Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","js","kotlin","rhino"],"created_at":"2025-01-25T03:57:22.801Z","updated_at":"2026-02-12T21:30:51.899Z","avatar_url":"https://github.com/paulcoding810.png","language":"Kotlin","readme":"# Android JavaScript Library\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.paulcoding/js.svg)](https://central.sonatype.com/artifact/com.paulcoding/js)\n\nA Kotlin-based Android library that provides seamless JavaScript execution and integration capabilities using Mozilla's Rhino engine.\n\n## Features\n\n- Execute JavaScript code from strings or files\n- Built-in network functions with fetch\n- HTML parsing with JSoup integration\n- Base64 decoding support\n- Console logging capabilities\n- JSON parsing and conversion\n- Coroutine support for asynchronous operations\n\n## Installation\n\nAdd the following dependency to your app's `build.gradle.kts`:\n\n```kotlin\ndependencies {\n    implementation(\"com.paulcoding:js:1.0.2\")\n}\n```\n\n## Initialization\n\nInitialize the library in your Application class:\n\n```kotlin\nclass MyApplication : Application() {\n    override fun onCreate() {\n        super.onCreate()\n        JS.initialize(applicationContext)\n    }\n}\n```\n\n## Usage\n\n### Basic JavaScript Execution\n\n```kotlin\n// Create JS instance\nval js = JS()\n\n// Execute JavaScript string\nsuspend fun executeJs() {\n    js.evaluateString\u003cString\u003e(\"'Hello, World!'\")\n        .onSuccess { result -\u003e\n            println(result) // Prints: Hello, World!\n        }\n        .onFailure { error -\u003e\n            error.printStackTrace()\n        }\n}\n\n// Call JavaScript function\nsuspend fun callJsFunction() {\n    js.callFunction\u003cInt\u003e(\"add\", arrayOf(2, 3))\n        .onSuccess { result -\u003e\n            println(result) // Prints: 5\n        }\n}\n```\n\n### Loading JS Object\n\n```kotlin\n// Load from app's files directory\nval js = JS(\"scripts\", \"main.js\")\n\n// Or with absolute path\nval js = JS(File(\"/path/to/script.js\"))\n```\n\n```kotlin\n// Pass custom properties to the JavaScript environment:\nval properties = mapOf(\n    \"apiKey\" to \"your-api-key\",\n    \"baseUrl\" to \"https://api.example.com\"\n)\nval js = JS(properties = properties)\n```\n\n### Built-in JavaScript Functions\n\n#### Network Requests (fetch)\n```javascript\n// Basic GET request\nconst response = fetch('https://api.example.com/data')\nconst jsonData = response.json()\n// or\nconst htmlDoc = response.html()\n// or\nconst textContent = response.text()\n\n// Advanced request with options\nconst response = fetch('https://api.example.com/data', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json'\n    },\n    body: JSON.stringify({ key: 'value' })\n})\n```\n\n#### Console Logging\n```javascript\nconsole.log('Debug message')\n```\n\n#### Base64 Decoding\n```javascript\nconst decoded = atob('SGVsbG8gV29ybGQ=')\n```\n\n## Dependencies\n\n- [Rhino](https://github.com/mozilla/rhino) - JavaScript engine\n- [Ktor](https://ktor.io/) - HTTP client\n- [Gson](https://github.com/google/gson) - JSON parsing\n- [JSoup](https://jsoup.org/) - HTML parsing\n\n## ProGuard Configuration\n\n```proguard\n### Rhino\n-keepattributes Signature\n-dontwarn org.mozilla.javascript.**\n-keep class org.mozilla.javascript.** { *; }\n-keep class org.jsoup.** { *; }\n-dontwarn org.jspecify.annotations.NullMarked\n\n### Ktor and OkHttp\n-keep class okhttp3.** { *; }\n-keep class com.squareup.okhttp3.** { *; }\n\n-keep class io.ktor.** { *; }\n-dontwarn java.lang.management.ManagementFactory\n-dontwarn java.lang.management.RuntimeMXBean\n\n### Gson\n-keep class com.google.gson.** { *; }\n\n### R8\n-dontwarn kotlin.Cloneable$DefaultImpls\n```\n\n## Requirements\n\n- Minimum SDK: 24\n- Kotlin: 1.8+\n- Java: 11\n\n## Credits\n\n[VBook Extensions](https://github.com/Darkrai9x/vbook-extensions)\n\n## License\n\nSee [License](LICENSE)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulcoding810%2Fjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulcoding810%2Fjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulcoding810%2Fjs/lists"}