Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

feat: extend plugin API supports communication #364

Merged
merged 13 commits into from Dec 14, 2022

Conversation

airslice
Copy link
Contributor

@airslice airslice commented Nov 30, 2022

close reearth/reearth#376

Overview

This PR enables plugin communication with other plugins.

What I've done

Implement the API:

type PluginExtensionInstance = {
  id: string;
  pluginId: string;
  name: string; 
  extensionId: string;
  extensionType: "widget" | "block";
};

reearth.plugins.instances: PluginExtensionInstance[]
reearth.plugins.postMessage(id: string; message: any)
reearth.on("pluginmessage", (e: { data: any, sender: string }) => {})

What I haven't done

How I tested

Test with plugin:

plugincomm.zip

Download & install & add multiple instances for test.
Also add block for test.

Screenshot

localhost_3000_edit_01gjy7yqpqnjzcvj0wsk7h0f4w_preview(1440 desktop)

Which point I want you to review particularly

Memo

@netlify
Copy link

netlify bot commented Nov 30, 2022

Deploy Preview for reearth-web ready!

Name Link
🔨 Latest commit 54a852d
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/639926c979074800092c92e1
😎 Deploy Preview https://deploy-preview-364--reearth-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codecov
Copy link

codecov bot commented Nov 30, 2022

Codecov Report

Merging #364 (54a852d) into main (1fcc75f) will decrease coverage by 0.07%.
The diff coverage is 1.85%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #364      +/-   ##
==========================================
- Coverage   24.61%   24.53%   -0.08%     
==========================================
  Files         596      597       +1     
  Lines       62659    62873     +214     
  Branches     1243     1243              
==========================================
+ Hits        15424    15428       +4     
- Misses      47189    47399     +210     
  Partials       46       46              
Impacted Files Coverage Δ
...rc/components/molecules/Visualizer/Plugin/hooks.ts 3.89% <0.00%> (-0.22%) ⬇️
...rc/components/molecules/Visualizer/Plugin/types.ts 0.00% <0.00%> (ø)
src/components/molecules/Visualizer/hooks.ts 0.00% <0.00%> (ø)
src/components/molecules/Visualizer/index.tsx 0.00% <0.00%> (ø)
src/components/molecules/Visualizer/storybook.tsx 0.00% <0.00%> (ø)
...ponents/molecules/Visualizer/usePluginInstances.ts 0.00% <0.00%> (ø)
src/components/molecules/Visualizer/Plugin/api.ts 6.16% <4.16%> (-0.12%) ⬇️
...components/molecules/Visualizer/Plugin/context.tsx 32.03% <33.33%> (+0.03%) ⬆️

@airslice airslice marked this pull request as ready for review December 5, 2022 05:47
@airslice airslice merged commit 61e67ef into main Dec 14, 2022
@airslice airslice deleted the feat/plugin-api-communication branch December 14, 2022 01:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants