Kunkun API
Kunkun API is an NPM package designed for developers to create extensions for KK. It provides a set of APIs to interact with KK and access system resources.
As of now, there are 2 sandboxed environments to run the extension: web worker and iframe. APIs for the two environments are almost identical.
I made separate subpackages for them for clarity and make tree-shaking easier.
The APIs are exposed in the following subpackages:
@kksh/api/ui/iframe
@kksh/api/ui/worker
The /ui
subpackage means they are designed for UI extensions (i.e. extension has GUI).
This is to distinguish from “headless” extensions for non-UI extensions (which I plan to develop in the future).
See API Reference for more details.
https://docs.api.kunkun.sh/ is the generated API documentation with a full list of APIs and their type definitions.
Playground
Here is a code editor playground with @kksh/api
installed. You can try out the API,
but don’t try to run it, as the API is not designed to run in the browser.
The sample code here is only for template extensions running in web worker environment.
APIs are imported from @kksh/api/ui/worker
.
The custom UI extension running in iframe have similar APIs, imported from @kksh/api/ui/iframe
.
The playground is only to give you a taste of how the API are called and what kind of APIs are available. For more details and examples, please keep read the following pages.