@netless/fastboard-react 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +11 -28
  2. package/package.json +4 -5
package/README.md CHANGED
@@ -7,36 +7,19 @@ The React wrapper of [@netless/fastboard-ui](https://github.com/netless-io/fastb
7
7
  ```js
8
8
  import React, { useEffect, useState } from "react";
9
9
  import ReactDOM from "react-dom";
10
- import { createFastboard, Fastboard } from "@netless/fastboard-react";
10
+ import { useFastboard, Fastboard } from "@netless/fastboard-react";
11
11
 
12
12
  function App() {
13
- const [app, setApp] = useState(null);
14
-
15
- useEffect(() => {
16
- let app_instance;
17
-
18
- createFastboard({
19
- sdkConfig: {
20
- appIdentifier: "whiteboard_app_id",
21
- },
22
- joinRoom: {
23
- uid: "unique_user_id",
24
- uuid: "room-uuid",
25
- roomToken: "NETLESSROOM_...",
26
- },
27
- managerConfig: {
28
- cursor: true,
29
- },
30
- }).then(app => {
31
- setApp((app_instance = app));
32
- });
33
-
34
- return () => {
35
- if (app_instance) {
36
- app_instance.destroy();
37
- }
38
- };
39
- }, []);
13
+ const app = useFastboard(() => ({
14
+ sdkConfig: {
15
+ appIdentifier: "whiteboard_app_id",
16
+ },
17
+ joinRoom: {
18
+ uid: "unique_user_id",
19
+ uuid: "room-uuid",
20
+ roomToken: "NETLESSROOM_...",
21
+ },
22
+ }));
40
23
 
41
24
  return <Fastboard app={app} />;
42
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/fastboard-react",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "React components of @netless/fastboard.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -12,8 +12,8 @@
12
12
  "react": "*"
13
13
  },
14
14
  "dependencies": {
15
- "@netless/fastboard-core": "0.3.2",
16
- "@netless/fastboard-ui": "0.3.2"
15
+ "@netless/fastboard-core": "0.3.3",
16
+ "@netless/fastboard-ui": "0.3.3"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@netless/esbuild-plugin-inline-sass": "0.1.0",
@@ -29,6 +29,5 @@
29
29
  "dev": "vite"
30
30
  },
31
31
  "module": "dist/index.mjs",
32
- "types": "dist/index.d.ts",
33
- "readme": "## @netless/fastboard-react\n\nThe React wrapper of [@netless/fastboard-ui](https://github.com/netless-io/fastboard/tree/main/packages/fastboard-ui).\n\n## Usage\n\n```js\nimport React, { useEffect, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { createFastboard, Fastboard } from \"@netless/fastboard-react\";\n\nfunction App() {\n const [app, setApp] = useState(null);\n\n useEffect(() => {\n let app_instance;\n\n createFastboard({\n sdkConfig: {\n appIdentifier: \"whiteboard_app_id\",\n },\n joinRoom: {\n uid: \"unique_user_id\",\n uuid: \"room-uuid\",\n roomToken: \"NETLESSROOM_...\",\n },\n managerConfig: {\n cursor: true,\n },\n }).then(app => {\n setApp((app_instance = app));\n });\n\n return () => {\n if (app_instance) {\n app_instance.destroy();\n }\n };\n }, []);\n\n return <Fastboard app={app} />;\n}\n\nReactDOM.render(<App />, document.getElementById(\"app\"));\n```\n\n### License\n\nMIT @ [netless](https://github.com/netless-io)\n"
32
+ "types": "dist/index.d.ts"
34
33
  }