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
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
The following JSAPIs are supported through the JS bridge (the list is updated over time):Basic
Basic
getAppIdSync- Get the Mini Program App ID synchronously
Tab Bar
Tab Bar
hideTabBar- Hide the tab barsetTabBarStyle- Set the tab bar style
Route
Route
switchTab- Jump to a tab bar page and close all non-tab pagesnavigateTo- Keep the current page and open another pagereLaunch- Close all pages and open the specified pagenavigateBack- Return to the previous page(s)redirectTo- Close the current page and open another page
Feedback
Feedback
alert- Alert boxconfirm- Confirm boxprompt- Prompt boxshowToast- Show a toasthideToast- Hide the toastshowLoading- Show the loading hinthideLoading- Hide the loading hintshowActionSheet- Display an action menu
Pull-down Refresh
Pull-down Refresh
onPullDownRefresh- Page handler for the pull-to-refresh eventstopPullDownRefresh- Stop pull-to-refresh on the current pagestartPullDownRefresh- Start pull-to-refresh
Other UI
Other UI
createAnimation- Create an animation instancehideKeyboard- Hide the keyboardpageScrollTo- Scroll to a position on the pagesetBackgroundColor- Set the background colorsetCanPullDown- Set whether the page supports pull-down
Storage
Storage
setStorage- Store datasetStorageSync- Store data synchronouslygetStorage- Get cached datagetStorageSync- Get cached data synchronouslyremoveStorage- Remove cached dataremoveStorageSync- Remove cached data synchronouslyclearStorage- Clear the local cacheclearStorageSync- Clear the local cache synchronously
Location
Location
getLocation- Get the user’s current location
Network
Network
request- Network requestgetNetworkType- Get the current network status
Device
Device
getSystemInfo- Get system informationgetClipboard- Get clipboard datasetClipboard- Set clipboard datashowAuthGuide- Guide the user to grant a permissionscan- Scan a QR code or barcodeonMemoryWarning- Listen for low-memory warningsoffMemoryWarning- Stop listening for low-memory warnings
Web View
Web View
createWebViewContext- Create a context to send messages to a web-view
Open Capabilities
Open Capabilities
getAuthCode- Get an authorization codegetOpenUserInfo- Get basic user informationtradePay- Start a payment
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