@mindroid/core
v0.3.0
Published
Mindroid core runtime, bridge and plugin host
Maintainers
Readme
@mindroid/core
Core runtime, bridge contract, permission gate, and plugin host for the Mindroid JS-first Android framework.
Tip: Install
@mindroid/sdkto get the runtime and all plugins in a single package.
Install
npm install @mindroid/coreWhat's included
MindroidRuntime— plugin host with module registry, capability index, and audit logMindroidBridge/TransportBridge— JSON-RPC style bridge to native Android channelsWebFallbackBridge— throws descriptive errors when running outside Android (for early detection)MockBridge— map-based stub for unit tests and browser dev; supportsemit()for event simulationdefineModule/createRuntime— plugin factory helpersStubEngine— test double for the JS engine that records calls and supportsemit()- Widget types —
Text,Button,Image,TextInput,Spacer,Column,Row,ScrollView
Quick example
import { createRuntime, MockBridge, defineModule } from "@mindroid/core";
const bridge = new MockBridge({
"permissions.ensure": "granted",
});
const myModule = defineModule("greeter", ["greet.hello"], (ctx) => ({
async sayHello() {
await ctx.permissions.ensure("greet.hello");
return "Hello from Mindroid!";
},
}));
const runtime = createRuntime(bridge, myModule);
console.log(runtime.has("greeter")); // true
console.log(runtime.hasCapability("greet.hello")); // trueTesting with MockBridge
import { MockBridge } from "@mindroid/core";
const bridge = new MockBridge({ "network.getState": { connected: true, transport: "wifi" } });
// Override at runtime
bridge.mock("network", "getState", { connected: false, transport: "unknown" });
// Simulate native events
bridge.emit("network", "changed", { connected: false });Links
- @mindroid/sdk — all-in-one install
- Mindroid monorepo
