JSAPI Reference
Basic
API Name | Function Description |
Judge whether the current Mini Program API, incoming parameter or return value, component, attribute, etc. are supported in the current version. | |
Get the SDK version. | |
Obtain the Mini Program App ID synchronously. | |
Obtain the running version of the current Mini Program. |
In-App Event
API Name | Function Description |
Unlisten for the event that the mini program is switched to background from foreground. | |
Unlisten for the event that the mini program is switched to foreground from background. | |
Listen for the event that the mini program is switched to background from foreground. | |
Listen for the event that the mini program is switched to foreground from background. | |
Unlisten for the event that JS errors occur in the mini program. | |
Listen for the event that errors occur in the mini program. | |
Unlisten for the unhandledrejection event. | |
Listen for the unhandledrejection event. |
UI
NavigationBar
API Name | Function Description |
Hide back to home button. | |
Show navigation bar loading. | |
Hide navigation bar loading. | |
Set the navigation bar text and style. |
TabBar
API Name | Function Description |
Hide the tabBar. | |
Set the style of tabBar. |
Note: For the FAQs of tab bar, refer to TabBar FAQ.
Route
API Name | Function Description |
Jump to the specified tabBar page and close all other pages that are not tabBar. | |
Maintain the current page and jump to the specified page within the application. Use | |
Close the current page and return to the previous one or more pages. | |
Close the current page and jump to the specified page within the application. | |
Close all current pages and jump to the specified page within the application. |
FeedBack
API Name | Function Description |
Alert box. | |
Confirm box. | |
Prompt box. | |
Show the loading hint. | |
Hide the loading hint. | |
Show a weak hint, which disappears in the specified seconds. | |
Hide the weak hint. | |
Display an operation menu. |
Pulldown
API Name | Function Description |
Start the pull-to-refresh function. | |
On the Page, customize the onPullDownRefresh function to listen to the pull-to-refresh event of user. | |
Stop the pull-to-refresh for the current page. |
Contact
API Name | Function Description |
Choose contact from system contact. |
Choose Data
API Name | Function Description |
Open a date selection list. |
Animation
API Name | Function Description |
Create an instance of animation. |
Canvas
API Name | Function Description |
Create the context of the canvas. |
Keyboard
API Name | Function Description |
Hide keyboard. |
Scroll
API Name | Function Description |
Scroll to the destination location of the page. |
SelectorQuery
API Name | Function Description |
Create an instance of SelectorQuery. |
Multiple Level Select
API Name | Function Description |
Multiple level selector, used for associated select with multiple levels. |
Set Background
API Name | Function Description |
Set background color. |
Set Page Pulldown
API Name | Function Description |
Set whether page can support pulldown. |
Media
Image
API Name | Function Description |
Choose image from camera or album of cellphone. | |
Preview image. | |
Save the online images to cellphone album. | |
Get the information of the image. | |
Compress large images to fulfill the size restrictions from some mini programs. |
Storage
API Name | Function Description |
Get cached data. | |
Get cached data synchronously. | |
Store the data in the specified key in the local cache, which overlaps the original data corresponding to the key. | |
Store synchronously the data in the specified key in the local cache. | |
Remove cached data. | |
Remove cached data synchronously. | |
Clear local data cache. | |
Clear local data cache synchronously. |
File
API Name | Function Description |
Save file to the device. | |
Get the information of the file. | |
Get the information of the saved file. | |
Get the information of all the saved file. | |
Remove the saved file. | |
Choose a file to upload. | |
Enable users to preview a PDF file within the mini program. |
Location
API Name | Function Description |
Get the current geographical location of the user. | |
View the location on the built-in map. | |
Open the built-in map to choose a location. |
Map
API Name | Function Description |
Create and return a map context object mapContext. |
Network
API Name | Function Description |
Network request. | |
Upload the local resource to the developer server. | |
Download file resource to local location. | |
Create a WebSocket connection. | |
Listen to the event of enabling the WebSocket connection. | |
Unlisten to the event of enabling the WebSocket connection. | |
Listen to WebSocket error events. | |
Unlisten to WebSocket error events. | |
Send data over WebSocket connection. | |
Listen to the event of receiving server messages by WebSocket. | |
Unlisten to the event of receiving server messages by WebSocket. | |
Close the WebSocket connection. | |
Listen to the event of closing the WebSocket connection. | |
Unlisten to the event of closing the WebSocket connection. |
Device
System Information
API Name | Function Description |
Get system information. |
Network Status
API Name | Function Description |
Get the current network status. |
Clipboard
API Name | Function Description |
Get the clipboard data. | |
Set the clipboard data. |
Watch Shake
API Name | Function Description |
The watchshake function. |
Accelerometer
API Name | Function Description |
Listen to the acceleration data event. | |
Unlisten to the acceleration data event. |
Compass
API Name | Function Description |
Listen to the compass data change event. | |
Unlisten to the compass data change event. |
Vibrate
API Name | Function Description |
Invoke the vibrate ability of device. |
Make Phone Call
API Name | Function Description |
Make a phone call. |
Get Server Time
API Name | Function Description |
Get the server time. |
Capture Screen
API Name | Function Description |
Listen to the capture screen event by users. | |
Cancel the listen to the capture screen event by users. |
Screen Brightness
API Name | Function Description |
Set whether screen keeps awake. | |
Get the screen brightness. | |
Set the screen brightness. |
Screen Orientation
API Name | Function Description |
Get screen orientation | |
Set screen orientation |
Setting
API Name | Function Description |
Open the mini program settings page. | |
Obtain the user's current settings. |
Add Phone Contact
API Name | Function Description |
Add contact to phone contact. |
Permission Guide
API Name | Function Description |
Guide user to grant the authorization when the permission needed. |
Scan
API Name | Function Description |
Call the scanning QR code function. |
Memory Warning
API Name | Function Description |
Listen to the insufficient memory alarm event. | |
Unlisten to the insufficient memory alarm event. |
Battery Information
API Name | Function Description |
Obtain the battery level and the charging state of the current device asynchronously. | |
Obtain the battery level and the charging state of the current device synchronously. |
Bluetooth
Reference | Description |
Provide the system requirement and the process flow on how the Bluetooth APIs work. | |
List the normal error code and relative solutions. | |
FAQs about using Bluetooth API. |
BLE
API Name | Function Description |
Connect to low energy Bluetooth devices. | |
Disconnect to low energy Bluetooth devices. | |
Get the characteristics of low energy Bluetooth devices. | |
Get all the low energy Bluetooth devices that are discovered, including the connected devices. | |
Enable the function to notify changes to the characteristic value. | |
Disable the function to notify changes to the characteristic value. | |
Disable the the event listener for the connection status. | |
Enable the event listener for changes to the characteristic value. | |
Enable the event listener for changes to the connection status, such as device lost and device disconnected. | |
Read the characteristic value. | |
Write data to the characteristic value. |
Bluetooth
API Name | Function Description |
Close the Bluetooth module in the mini program. | |
Initialize the Bluetooth module in the mini program. | |
Check the Bluetooth adapter status in the mini program. | |
Start discovering Bluetooth devices. | |
Stop discovering Bluetooth devices. | |
Get all the Bluetooth devices that are discovered, including those that are connected to the current device. | |
Get the Bluetooth devices that are connected. | |
Use this API when a new Bluetooth device is found. | |
Remove the Bluetooth devices that are found. | |
Monitor the Bluetooth adapter state changes. | |
Remove the Bluetooth adapter with a state change. |
Sharing
API Name | Function Description |
Trigger the sharing. |
Update
API Name | Function Description |
Create an UpdateManager object. |
web-view
API Name | Function Description |
By creating |
Site Info
API Name | Function Description |
Get the site information. |
Open Capabilities
API Name | Function Description |
Jump to other mini program. | |
Return to the previous mini program, only when another mini program jumps to the current mini program. | |
Get auth code. | |
Get basic information about user. | |
Start to pay. | |
Sign the withholding contract. |