@polkadot-apps/productkit
v0.3.7
Published
Minimal product-facing window.host contract and helpers for apps running inside a Triangle User Agent
Maintainers
Readme
@polkadot-apps/productkit
Minimal app-facing product contract and helpers for apps that consume
window.host.
Install
npm install @polkadot-apps/productkitUse this package when you want a narrow, product-oriented runtime surface:
getAddress()storage.get/set/removestatements.subscribe/write/statuson("statement")/off("statement")
Adapters such as @polkadot-apps/productkit-adapter-scale mount real host
implementations onto this contract.
Minimal example
import { hasCoreProductKit } from "@polkadot-apps/productkit";
if (!hasCoreProductKit(window.host)) {
throw new Error("ProductKit surface unavailable");
}
const address = await window.host.getAddress();
await window.host.storage.set("last-address", address);
window.host.on("statement", (event) => {
console.log(event);
});Compatibility
- product-side package
- expects a host shell that provides the ProductKit-compatible
window.hostsurface
