@dolphy-app/extension-sdk
v0.7.0
Published
SDK for extension authors: defineServer, defineClient, defineRpc, usePanel, useInjection, useApp, useEngine, useRpc, defineMountable, callRpc, reactComponent, test harness
Downloads
1,324
Readme
@dolphy-app/extension-sdk
SDK for extension authors: defineServer, defineClient, defineRpc, usePanel, useInjection, useApp, useEngine, useRpc, defineMountable, callRpc, reactComponent, test harness
The package version equals the version of the Dolphy app release it was published from (0.7.0).
@dolphy-app/extension-sdk — extension code: defineServer and
defineClient describe the server and client exports of an extension
src/index.ts, defineRpc declares a call from a component to the server
part. Components of the client part use useApp, useEngine, useRpc,
usePanel and useInjection (@dolphy-app/extension-sdk/client; vue is a
peer dependency). A component is a Vue component (single-file .vue
components included) or a Mountable that defineMountable builds and that
draws with any framework; reactComponent and the React hooks
(@dolphy-app/extension-sdk/react) draw a React component, react and
react-dom being optional peer dependencies. createTestServer,
createTestClient and mountForTest (@dolphy-app/extension-sdk/testing)
run an extension against in-memory implementations of the app. The package
has no side effects: an extension src/index.ts can be imported in plain
Node.
import { defineClient, defineServer } from '@dolphy-app/extension-sdk';
import { defineRpc } from '@dolphy-app/extension-sdk/rpc';
import { useApp, useRpc } from '@dolphy-app/extension-sdk/client';
import { reactComponent } from '@dolphy-app/extension-sdk/react';
import { createTestServer } from '@dolphy-app/extension-sdk/testing';The package ships a guide in docs/ (node_modules/@dolphy-app/extension-sdk/docs/
after the install): a
quick start, recipes for
an exercise type,
a theme,
a command and a panel,
a panel in React,
a component of any framework,
events and storage,
hooks before a session and a batch,
calls between the parts, the engine and the window,
settings,
an importer and an exporter,
visibility conditions and dependencies, a path
without a build and notes on
debugging.
Installation
npm install @dolphy-app/extension-sdk