0.0.61 • Published 2 years ago
openblocks-sdk-workmeet v0.0.61
openblocks-sdk-workmeet
Usage
yarn:
yarn add openblocks-sdk-workmeetnpm:
npm install openblocks-sdk-workmeetIntegrate Openblocks' app/module into existing app page
- Publish your app/module in Openblocks.
- Set the app/module's access privilege as public.
- Add code in your existing app as below.
Import style
import "openblocks-sdk-workmeet/dist/style.css";For react app:
import { OpenblocksAppView } from "openblocks-sdk-workmeet";
<OpenblocksAppView appId="{YOUR_APPLICATION_ID}" />;OpenblocksViewProps
| Name | Type | Description | Default value |
|---|---|---|---|
| appId | string | The app's id in Openblocks. Required! | -- |
| baseUrl | string | Openblocks' api base url | https://api.openblocks.dev |
| onModuleEventTriggered | (eventName: string) => void | Triggered when module's custom event is triggered. Works only when the app is a module. | -- |
| onModuleOutputChange | (output: any) => void | Triggered when module's outputs change. Works only when the app is a module. | -- |
Invoke module methods
import { useRef } from "ref";
import { OpenblocksAppView } from "openblocks-sdk-workmeet";
function MyExistingAppPage() {
const appRef = useRef();
return (
<div>
<OpenblocksAppView appId={YOUR_APPLICATION_ID} ref={appRef} />;
<button onClick={() => appRef.current?.invokeMethod("some-method-name")}>
Invoke method
</button>
</div>
);
}For vanilla js:
import { bootstrapAppAt } from "openblocks-sdk-workmeet";
const node = document.querySelector("#my-app");
async function bootstrap() {
const instance = await bootstrapAppAt(YOUR_APPLICATION_ID, node);
// set module inputs
instance.setModuleInputs({ input1: "xxx", input2: "xxx" });
// invoke module methods
instance.setModuleInputs({ input1: "xxx", input2: "xxx" });
// listen module event trigger
instance.on("moduleEventTriggered", (eventName) => {
console.info("event triggered:", eventName);
});
// listen module output change
instance.on("moduleOutputChange", (data) => {
console.info("output data:", data);
});
}0.0.60
2 years ago
0.0.61
2 years ago
0.0.59
2 years ago
0.0.52
2 years ago
0.0.53
2 years ago
0.0.54
2 years ago
0.0.55
2 years ago
0.0.56
2 years ago
0.0.57
2 years ago
0.0.58
2 years ago
0.0.51
2 years ago
0.0.42
3 years ago
0.0.43
3 years ago
0.0.44
3 years ago
0.0.45
3 years ago
0.0.46
3 years ago
0.0.47
3 years ago
0.0.50
2 years ago
0.0.48
3 years ago
0.0.41
3 years ago
0.0.40-b
3 years ago
0.0.40-a
3 years ago
0.0.40
3 years ago
0.0.39-a
3 years ago
0.0.39
3 years ago
0.0.38
3 years ago
0.0.34
3 years ago
0.0.30
3 years ago