hylid-bridge is an npm package for Native Mini Programs that are launched from a foreign native app container (cross-app launch). It provides a normalized my.* API layer that works consistently regardless of which host app is running the Mini Program.
This package is only needed for cross-app launch scenarios — when your Native Mini Program is opened from a different native app. Standard Mini Apps running inside the Rebell SuperApp do not require
hylid-bridge: the my object is injected automatically by the SuperApp runtime.When to Use hylid-bridge
| Scenario | Use hylid-bridge? |
|---|---|
| Native Mini App in Rebell SuperApp | No — my.* available natively |
| H5 Mini App in Rebell SuperApp | Via CDN <script> tag (not this npm package) |
| Native Mini App launched cross-app (from a partner app) | Yes — install via npm |
Installation
Usage
Import the specific APIs you need directly from the package:Handling Platform Differences
When running cross-app, not all JSAPIs are available on every host platform. UseappEnv to detect the runtime and branch accordingly:
Supported APIs
Navigation
Navigation
UI Elements
UI Elements
alert- Show alert dialogconfirm- Show confirmation dialogshowToast- Show toast messageshowLoading- Show loading indicatorhideLoading- Hide loading indicatorshowActionSheet- Show action sheet
Storage
Storage
setStorage- Store datagetStorage- Retrieve dataremoveStorage- Remove dataclearStorage- Clear all data
Location
Location
getLocation- Get current locationopenLocation- Open location in mapchooseLocation- Choose a location
Network
Network
request- Make HTTP requestsuploadFile- Upload filesdownloadFile- Download files
System
System
getSystemInfo- Get system informationgetNetworkType- Get network typescan- Scan QR codes
Payment
Payment
tradePay- Process paymentssignContract- Sign contracts
Requirements
Domain Whitelisting
Error Handling
Always implement error handling — cross-app environments may not support every API:Next Steps
JSAPI Overview
Learn about all available JSAPIs
JSAPI Reference
Complete API reference