| Crates.io | klyx_extension_api |
| lib.rs | klyx_extension_api |
| version | 1.3.6 |
| created_at | 2025-07-18 05:12:19.197312+00 |
| updated_at | 2025-11-29 14:49:36.576964+00 |
| description | A Rust-based API for building WebAssembly extensions for the Klyx |
| homepage | https://github.com/klyx-dev/klyx_extension_api |
| repository | https://github.com/klyx-dev/klyx_extension_api |
| max_upload_size | |
| id | 1758630 |
| size | 92,465 |
A Rust-based API for building extensions for the Klyx platform. This API provides a WebAssembly-compatible interface for creating custom extensions that can interact with Android functionality and UI components.
The Klyx Extension API allows developers to create extensions using Rust that compile to WebAssembly (WASM).
wasm32-wasip1 target installedrustup target add wasm32-wasip1
cargo new --lib my_klyx_extension
cd my_klyx_extension
Cargo.toml:[package]
name = "my_klyx_extension"
version = "0.1.0"
edition = "2024"
[lib]
crate-type = ["cdylib"]
[dependencies]
klyx_extension_api = "1.2.0"
src/lib.rs:use klyx_extension_api::{self as klyx};
pub struct MyExtension;
impl klyx::Extension for MyExtension {
fn new() -> Self {
klyx::show_toast("Hello, World!", klyx::ToastDuration::Short);
Self
}
...
}
klyx::register_extension!(MyExtension);
cargo build --target wasm32-wasip1 --release
cargo build --target wasm32-wasip1
cargo build --target wasm32-wasip1 --release
The compiled WASM file will be located at:
target/wasm32-wasip1/release/your_extension_name.wasm
Here's a complete example of a simple extension:
use klyx_extension_api::{self as klyx};
struct TestExtension;
impl klyx::Extension for TestExtension {
fn new() -> Self {
klyx::show_toast("Hello, I am a test extension", klyx::ToastDuration::Long);
Self
}
fn uninstall(&self) {
klyx::show_toast("Uninstalling...", klyx::ToastDuration::Short);
}
}
klyx::register_extension!(TestExtension);
Contributions to the Klyx Extension API are welcome! Please ensure your code:
This project is licensed under the terms specified in the main Klyx project.
For questions, issues, or feature requests, please refer to the main Klyx project repository or documentation.