Socket
Book a DemoInstallSign in
Socket

openblocks-sdk-workmeet

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openblocks-sdk-workmeet

## Usage

latest
npmnpm
Version
0.0.61
Version published
Maintainers
1
Created
Source

openblocks-sdk-workmeet

Usage

yarn:

yarn add openblocks-sdk-workmeet

npm:

npm install openblocks-sdk-workmeet

Integrate 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

NameTypeDescriptionDefault value
appIdstringThe app's id in Openblocks. Required!--
baseUrlstringOpenblocks' api base urlhttps://api.openblocks.dev
onModuleEventTriggered(eventName: string) => voidTriggered when module's custom event is triggered. Works only when the app is a module.--
onModuleOutputChange(output: any) => voidTriggered 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);
  });
}

Keywords

openblocks

FAQs

Package last updated on 25 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.