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

  • alert - Show alert dialog
  • confirm - Show confirmation dialog
  • showToast - Show toast message
  • showLoading - Show loading indicator
  • hideLoading - Hide loading indicator
  • showActionSheet - Show action sheet
  • setStorage - Store data
  • getStorage - Retrieve data
  • removeStorage - Remove data
  • clearStorage - Clear all data
  • getLocation - Get current location
  • openLocation - Open location in map
  • chooseLocation - Choose a location
  • request - Make HTTP requests
  • uploadFile - Upload files
  • downloadFile - Download files
  • getSystemInfo - Get system information
  • getNetworkType - Get network type
  • scan - Scan QR codes
  • tradePay - Process payments
  • signContract - Sign contracts

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