Skip to content

feat: add iframe embed API for go-web#16

Merged
Huxpro merged 1 commit intomainfrom
Huxpro/iframe-embed-api
Mar 17, 2026
Merged

feat: add iframe embed API for go-web#16
Huxpro merged 1 commit intomainfrom
Huxpro/iframe-embed-api

Conversation

@Huxpro
Copy link
Copy Markdown
Member

@Huxpro Huxpro commented Mar 17, 2026

Summary

Implemented a pure-JS iframe embed API following RSCExplorer's pattern, enabling non-React sites to embed go-web components without React dependency.

  • src/embed.ts: Public mount() function (pure JS, zero dependencies) that creates iframe + postMessage communication
  • example/embed.html + embed-entry.tsx: iframe React app receiving options via postMessage
  • example-iframe-embed/: Test page demonstrating embed with dynamic example switching
  • Dev improvements: rsbuild multi-entry build, CORS proxy for testing against go.lynxjs.org

Key Features

  • Zero React dependency on host page — users only import embed.js
  • Configurable exampleBasePath supports cross-origin data sources
  • Dev server proxy avoids CORS issues during testing
  • Dynamic example switching via update() API
  • Export via "./embed" entry point in package.json

Test Plan

  1. Run cd example && pnpm dev (starts on localhost:5969)
  2. Open example-iframe-embed/index.html in browser
  3. Verify example switcher buttons work and data loads from production via proxy

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 17, 2026

Deploy Preview for lynx-go-web ready!

Name Link
🔨 Latest commit 8cca899
🔍 Latest deploy log https://app.netlify.com/projects/lynx-go-web/deploys/69b8a94fafb5ff00084cda9d
😎 Deploy Preview https://deploy-preview-16--lynx-go-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 project configuration.

Implements a pure-JS embed API (no React dependency) following
rscexplorer's pattern:

- src/embed.ts: Public mount() function, creates iframe + postMessage
- example/embed.html & embed-entry.tsx: iframe React app
- example-iframe-embed/: test page with dynamic example switching
- rsbuild config: CORS proxy, multi-entry build, port 5969
- README: document iframe embed usage and options
@Huxpro Huxpro force-pushed the Huxpro/iframe-embed-api branch from 94433d5 to 8cca899 Compare March 17, 2026 01:07
@Huxpro Huxpro merged commit 7e5e5fb into main Mar 17, 2026
7 checks passed
@Dugyu Dugyu deleted the Huxpro/iframe-embed-api branch April 16, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant