lowcoder-sdk

2.6.7 • Public • Published

lowcoder-sdk

Usage

yarn:

yarn add lowcoder-sdk

npm:

npm install lowcoder-sdk

Integrate Lowcoder's app/module into existing app page

  1. Publish your app/module in Lowcoder.
  2. Set the app/module's access privilege as public.
  3. Add code in your existing app as below.

Import style

import "lowcoder-sdk/dist/style.css";

For react app:

import { LowcoderAppView } from "lowcoder-sdk";

<LowcoderAppView appId="{YOUR_APPLICATION_ID}" />;

LowcoderViewProps

Name Type Description Default value
appId string The app's id in Lowcoder. Required! --
baseUrl string Lowcoder's api base url --
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 { LowcoderAppView } from "lowcoder-sdk";

function MyExistingAppPage() {
  const appRef = useRef();
  return (
    <div>
      <LowcoderAppView appId={YOUR_APPLICATION_ID} ref={appRef} />;
      <button onClick={() => appRef.current?.invokeMethod("some-method-name")}>
        Invoke method
      </button>
    </div>
  );
}

For vanilla js:

import { bootstrapAppAt } from "lowcoder-sdk";

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);
  });
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.6.711latest

Version History

VersionDownloads (Last 7 Days)Published
2.6.711
2.6.61
2.6.52
2.6.42
2.6.32
2.6.22
2.6.11
2.6.01
2.5.52
2.5.42
2.5.32
2.5.21
2.5.12
2.4.171
2.4.1620
2.4.151
2.4.141
2.4.131
2.4.121
2.4.112
2.4.101
2.4.82
2.4.71
2.4.62
2.4.52
2.4.41
2.4.31
2.4.22
2.4.11
2.4.01
2.4.0-beta-51
2.4.0-beta-41
2.4.0-beta-31
2.4.0-beta-21
2.4.0-beta-11
2.4.0-beta3
2.3.42
2.3.31
2.3.21
2.3.12
2.3.01
2.1.111
2.1.101
2.1.91
2.1.71
2.1.61
2.1.51
2.1.41
2.1.32
2.1.21
2.1.11
2.1.01
0.0.413
0.0.401

Package Sidebar

Install

npm i lowcoder-sdk

Weekly Downloads

103

Version

2.6.7

License

MIT

Unpacked Size

24 MB

Total Files

169

Last publish

Collaborators

  • lowcoderbot