Skip to main content
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. Use appEnv to detect the runtime and branch accordingly:

Supported APIs

The following JSAPIs are supported through the JS bridge (the list is updated over time):
  • getAppIdSync - Get the Mini Program App ID synchronously
  • hideTabBar - Hide the tab bar
  • setTabBarStyle - Set the tab bar style
  • switchTab - Jump to a tab bar page and close all non-tab pages
  • navigateTo - Keep the current page and open another page
  • reLaunch - Close all pages and open the specified page
  • navigateBack - Return to the previous page(s)
  • redirectTo - Close the current page and open another page
  • alert - Alert box
  • confirm - Confirm box
  • prompt - Prompt box
  • showToast - Show a toast
  • hideToast - Hide the toast
  • showLoading - Show the loading hint
  • hideLoading - Hide the loading hint
  • showActionSheet - Display an action menu
  • onPullDownRefresh - Page handler for the pull-to-refresh event
  • stopPullDownRefresh - Stop pull-to-refresh on the current page
  • startPullDownRefresh - Start pull-to-refresh
  • createAnimation - Create an animation instance
  • hideKeyboard - Hide the keyboard
  • pageScrollTo - Scroll to a position on the page
  • setBackgroundColor - Set the background color
  • setCanPullDown - Set whether the page supports pull-down
  • setStorage - Store data
  • setStorageSync - Store data synchronously
  • getStorage - Get cached data
  • getStorageSync - Get cached data synchronously
  • removeStorage - Remove cached data
  • removeStorageSync - Remove cached data synchronously
  • clearStorage - Clear the local cache
  • clearStorageSync - Clear the local cache synchronously
  • getLocation - Get the user’s current location
  • request - Network request
  • getNetworkType - Get the current network status
  • getSystemInfo - Get system information
  • getClipboard - Get clipboard data
  • setClipboard - Set clipboard data
  • showAuthGuide - Guide the user to grant a permission
  • scan - Scan a QR code or barcode
  • onMemoryWarning - Listen for low-memory warnings
  • offMemoryWarning - Stop listening for low-memory warnings
  • createWebViewContext - Create a context to send messages to a web-view
  • getAuthCode - Get an authorization code
  • getOpenUserInfo - Get basic user information
  • tradePay - Start a payment

Requirements

Applications using the JS bridge in cross-app scenarios may need to:
  • Request specific permissions from host platforms
  • Whitelist domains for API calls
  • Handle cases where certain APIs are not available on the host platform

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