# API
# Render
# Canvas
API | 说明 |
---|---|
wx.createCanvas | Create a canvas object The first time when it is called, it creates an on-screen canvas. After that it creates off-screen canvases when called. |
# Canvas
API | 说明 |
---|---|
Canvas.getContext | Acquire canvas object's drawing context |
Canvas.toDataURL | Return the drawing content on the canvas in a data URI format |
Canvas.toTempFilePath | Save the current canvas as a temporary file and generate the corresponding temporary file path. |
Canvas.toTempFilePathSync | Canvas.toTempFilePath 的同步版本 |
RenderingContext | You can acquire the CanvasRenderingContext2D object via the Canvas.getContext('2d') interface. CanvasRenderingContext2D implements most attributes and methods defined by HTML Canvas 2D Context. You can acquire the WebGLRenderingContext object via the Canvas.getContext('webgl') interface. |
WebGLRenderingContext implements all attributes, methods and constants defined by WebGL 1.0. |
# Font
API | 说明 |
---|---|
wx.getTextLineHeight | Acquire the height of the text in one row |
wx.loadFont | Load custom font files |
# Frame
API | 说明 |
---|---|
wx.setPreferredFramesPerSecond | Rendering frame rate can be modified. The default rendering frame rate is 60 frames per second. After modification, the callback frequency of the requestAnimationFrame will change. |
cancelAnimationFrame | Cancel an animation frame request that was added to the plan through previously calling the requestAnimationFrame method |
requestAnimationFrame | Execute when next redrawing is carried out. |
# Image
API | 说明 |
---|---|
wx.createImage | Create an image object |
Image | Image object |
# AD
API | 说明 |
---|---|
wx.createBannerAd | Create a banner ad component. Use the SDKVersion of the returned object of wx.getSystemInfoSync() to determine whether the base library version number is 2.0.4 or above before using the API again. Meanwhile, the developer tools do not currently support debugging this API. Debugging can be carried out directly on a physical device. |
wx.createRewardedVideoAd | Create rewarded video advertisements component. Use the SDKVersion of the returned object of wx.getSystemInfoSync() to determine whether the base library version number is 2.0.4 or above before using the API again. Meanwhile, the developer tools do not currently support debugging this API. Debugging can be carried out directly on a physical device. |
# BannerAd
API | 说明 |
---|---|
BannerAd.destroy | Destroy banner ad |
BannerAd.hide | Hide banner ad |
BannerAd.offError | 取消监听banner ad error event |
BannerAd.offLoad | 取消监听banner ad loading event |
BannerAd.offResize | 取消监听banner ad dimension change event |
BannerAd.onError | 监听banner ad error event |
BannerAd.onLoad | 监听banner ad loading event |
BannerAd.onResize | 监听banner ad dimension change event |
BannerAd.show | Display banner ads. |
# RewardedVideoAd
API | 说明 |
---|---|
RewardedVideoAd.load | Hide rewarded video advertisements |
RewardedVideoAd.offClose | 取消监听User presses Close Ad button event |
RewardedVideoAd.offError | 取消监听Rewarded video error event |
RewardedVideoAd.offLoad | 取消监听Rewarded video advertisement loading event |
RewardedVideoAd.onClose | 监听User presses Close Ad button event |
RewardedVideoAd.onError | 监听Rewarded video error event |
RewardedVideoAd.onLoad | 监听Rewarded video advertisement loading event |
RewardedVideoAd.show | Display rewarded video advertisements. Rewarded video advertisements will enter the screen from the bottom. |
# Debug
API | 说明 |
---|---|
wx.setEnableDebug | Set to turn debug switch on/off, this switch is also valid in the official version. |
# Device
# Accelerometer
API | 说明 |
---|---|
wx.onAccelerometerChange | 监听Acceleration data event. Frequency depends on the interval parameter of wx.startAccelerometer(). wx.stopAccelerometer() can be used to stop monitoring. |
wx.startAccelerometer | Start monitoring acceleration data. |
wx.stopAccelerometer | Stop monitoring acceleration data. |
# Battery
API | 说明 |
---|---|
wx.getBatteryInfo | Obtain device battery. The synchronizing API, wx.getBatteryInfoSync, is unavailable on iOS. |
wx.getBatteryInfoSync | wx.getBatteryInfo 的同步版本 |
# Clipboard
API | 说明 |
---|---|
wx.getClipboardData | Obtain system clipboard content |
wx.setClipboardData | Set system clipboard content |
# Compass
API | 说明 |
---|---|
wx.onCompassChange | 监听Compass data change event (frequency: 5 times/second). Monitoring automatically starts after the API is called and can be stopped by wx.stopCompass. |
wx.startCompass | Start monitoring compass data |
wx.stopCompass | Stop monitoring compass data |
# Gyroscope
API | 说明 |
---|---|
wx.onGyroscopeChange | Monitor gyroscope data. Frequency depends on the interval parameter of wx.startGyroscope(). Users can use wx.stopGyroscope() to stop monitoring. |
wx.startGyroscope | Start monitoring gyroscope data |
wx.stopGyroscope | Stop monitoring gyroscope data |
# Device Motion
API | 说明 |
---|---|
wx.onDeviceMotionChange | 监听Device direction change event. Frequency depends on the interval parameter of wx.startDeviceMotionListening(). Users can use wx.stopDeviceMotionListening() to stop monitoring. |
wx.startDeviceMotionListening | Start monitoring device direction changes |
wx.stopDeviceMotionListening | Stop monitoring device direction changes |
# Network
API | 说明 |
---|---|
wx.getNetworkType | Acquire network type |
wx.onNetworkStatusChange | 监听Network status change event |
# Orientation
API | 说明 |
---|---|
wx.offDeviceOrientationChange | 取消监听Screen orientation switch event |
wx.onDeviceOrientationChange | 监听Screen orientation switch event |
# Performance
API | 说明 |
---|---|
wx.onMemoryWarning | 监听Insufficient memory warning event |
# Screen
API | 说明 |
---|---|
wx.getScreenBrightness | Acquire screen brightness |
wx.setKeepScreenOn | Whether Settings maintain "always on" status or not. Effective only in the current Mini Program, it will no longer be in effect once the Mini Program exits. |
wx.setScreenBrightness | Set screen brightness |
# Vibrate
API | 说明 |
---|---|
wx.vibrateLong | Make the phone vibrate for a long period of time (400 ms) |
wx.vibrateShort | Make the phone vibrate for a short period of time (15 ms). Only valid on iPhone 7/7 Plus and above and Android models |
# File
API | 说明 |
---|---|
wx.getFileSystemManager | Obtain the only file system manager globally |
# FileSystemManager
API | 说明 |
---|---|
FileSystemManager.access | Judge whether the file/directory exists |
FileSystemManager.accessSync | FileSystemManager.access 的同步版本 |
FileSystemManager.appendFile | Add content at the end of the file |
FileSystemManager.appendFileSync | FileSystemManager.appendFile 的同步版本 |
FileSystemManager.copyFile | Copy file |
FileSystemManager.copyFileSync | FileSystemManager.copyFile 的同步版本 |
FileSystemManager.getFileInfo | Obtain information of the local temporary file or cache file under this Mini Program |
FileSystemManager.getSavedFileList | Obtain the saved local cache file list under this Mini Program |
FileSystemManager.mkdir | Create directory |
FileSystemManager.mkdirSync | FileSystemManager.mkdir 的同步版本 |
FileSystemManager.readdir | Read the file list in the directory |
FileSystemManager.readdirSync | FileSystemManager.readdir 的同步版本 |
FileSystemManager.readFile | Read local file content |
FileSystemManager.readFileSync | FileSystemManager.readFile 的同步版本 |
FileSystemManager.removeSavedFile | Delete the saved local cache file under this Mini Program |
FileSystemManager.rename | Rename file. Then the file can be moved from oldPath to newPath |
FileSystemManager.renameSync | FileSystemManager.rename 的同步版本 |
FileSystemManager.rmdir | Delete directory |
FileSystemManager.rmdirSync | FileSystemManager.rmdir 的同步版本 |
FileSystemManager.saveFile | Save the temporary file locally. This API will move the temporary file. Therefore, after the API is called, tempFilePath will no longer be available. |
FileSystemManager.saveFileSync | FileSystemManager.saveFile 的同步版本 |
FileSystemManager.stat | Obtain the file Stats object |
FileSystemManager.statSync | FileSystemManager.stat 的同步版本 |
FileSystemManager.unlink | Delete a file |
FileSystemManager.unlinkSync | FileSystemManager.unlink 的同步版本 |
FileSystemManager.unzip | Decompress file |
FileSystemManager.writeFile | Write file |
FileSystemManager.writeFileSync | FileSystemManager.writeFile 的同步版本 |
# Stats
API | 说明 |
---|---|
Stats.isDirectory | Judge whether the current file is a directory |
Stats.isFile | Judge whether the current file is a normal file |
# Location
API | 说明 |
---|---|
wx.getLocation | Obtain the current location and speed. When the user exits the Mini Program, this API cannot be called. |
# Media
# Audio
API | 说明 |
---|---|
wx.createInnerAudioContext | Create the InnerAudioContext object of the inner audio context |
wx.getAvailableAudioSources | Acquire currently supported audio input source |
wx.setInnerAudioOption | Set the playback options for InnerAudioContext, which will be available in the current Mini Program after being set. |
# InnerAudioContext
API | 说明 |
---|---|
InnerAudioContext.destroy | Destroy current instance |
InnerAudioContext.offCanplay | 取消监听Event in which audio enters the playable status. Smooth play is not guaranteed |
InnerAudioContext.offEnded | 取消监听"Audio naturally plays till the end" event |
InnerAudioContext.offError | 取消监听Audio play error event |
InnerAudioContext.offPause | 取消监听Audio pause event |
InnerAudioContext.offPlay | 取消监听Audio play event |
InnerAudioContext.offSeeked | 取消监听"Audio completes jump operation" event |
InnerAudioContext.offSeeking | 取消监听"Audio performs jump operation" event |
InnerAudioContext.offStop | 取消监听Audio stop event |
InnerAudioContext.offTimeUpdate | 取消监听Audio play progress update event |
InnerAudioContext.offWaiting | 取消监听Audio loading event. Triggered when the audio data is insufficient and needs to stop to load |
InnerAudioContext.onCanplay | 监听Event in which audio enters the playable status. Smooth play is not guaranteed |
InnerAudioContext.onEnded | 监听"Audio naturally plays till the end" event |
InnerAudioContext.onError | 监听Audio play error event |
InnerAudioContext.onPause | 监听Audio pause event |
InnerAudioContext.onPlay | 监听Audio play event |
InnerAudioContext.onSeeked | 监听"Audio completes jump operation" event |
InnerAudioContext.onSeeking | 监听"Audio performs jump operation" event |
InnerAudioContext.onStop | 监听Audio stop event |
InnerAudioContext.onTimeUpdate | 监听Audio play progress update event |
InnerAudioContext.onWaiting | 监听Audio loading event. Triggered when the audio data is insufficient and needs to stop to load |
InnerAudioContext.pause | Pause. The audio will continue playing from where it was paused |
InnerAudioContext.play | Play |
InnerAudioContext.seek | Jump to the specified position |
InnerAudioContext.stop | Stop. The audio will start playing from the beginning if it was stopped. |
# Image
API | 说明 |
---|---|
wx.chooseImage | Select image from local album or take photo with camera. |
wx.previewImage | Preview the image in full screen on a new page. During the preview, users can save or send the image to their friends. |
wx.saveImageToPhotosAlbum | Save image to system album. |
# Recorder
API | 说明 |
---|---|
wx.getRecorderManager | Acquire globally unique recording manager RecorderManager |
# RecorderManager
API | 说明 |
---|---|
RecorderManager.onError | 监听Recording error event |
RecorderManager.onFrameRecorded | 监听"Specified frame size of file is recorded" event. If frameSize is set, it calls back this event. |
RecorderManager.onInterruptionBegin | 监听Recording is occupied and interruption starts event. The following scenarios trigger this event: WeChat voice chat, WeChat video chat. After this event is triggered, recording pauses. The pause event is triggered after this event |
RecorderManager.onInterruptionEnd | 监听Recording interruption ends event. After receiving the interruptionBegin event, all recordings in the Mini Program will stop. Only after receiving this event can recording be started again. |
RecorderManager.onPause | 监听Recording pause event |
RecorderManager.onResume | 监听Recording continue event |
RecorderManager.onStart | 监听Recording start event |
RecorderManager.onStop | 监听Recording end event |
RecorderManager.pause | Pause recording |
RecorderManager.resume | Continue recording |
RecorderManager.start | Start recording |
RecorderManager.stop | Stop recording |
# Video
API | 说明 |
---|---|
wx.createVideo | Create a video |
# Video
API | 说明 |
---|---|
Video.destroy | Destroy video |
Video.exitFullScreen | Video exits full screen |
Video.offEnded | 取消监听Video end event |
Video.offError | 取消监听Video error event |
Video.offPause | 取消监听Video pause event |
Video.offPlay | 取消监听Video play event |
Video.offTimeUpdate | 取消监听Video playback progress update event |
Video.offWaiting | 取消监听Video buffer event |
Video.onEnded | 监听Video end event |
Video.onError | 监听Video error event |
Video.onPause | 监听Video pause event |
Video.onPlay | 监听Video play event |
Video.onTimeUpdate | 监听Video playback progress update event |
Video.onWaiting | 监听Video buffer event |
Video.pause | Pause video |
Video.play | Play video |
Video.requestFullScreen | Video enters full screen |
Video.seek | Video jump |
Video.stop | Stop video |
# Midas Payment
API | 说明 |
---|---|
wx.requestMidasPayment | Launch Midas payment |
midasCancelPay | For Mini Games with virtual payment activated, if the order number with game coins deducted is within valid period, this order can be canceled through the interface |
midasGetBalance | It enables you to view a user's remaining game coins for the Mini Game with virtual payment activated |
midasPay | It enables you to deduct a user's remaining game coins for the Mini Game with virtual payment activated. There is a possibility that the API calling times out or a system failure is returned but the game coins are deducted. In the case, use the same bill_no to repeatedly call the API until system failure is not returned and deduction will not be made repeatedly. Alternatively, call the payment canceling API to cancel this deduction. |
midasPresent | It enables you to gift a user the game coins for the Mini Game with virtual payment activated. |
# Network
# Download
API | 说明 |
---|---|
wx.downloadFile | When downloading file resources to a local directory, the client will directly initiate an HTTP GET request, and the local temporary path of the file will be returned. Read Related Instructions before use. |
Note: Specify a reasonable Content-Type field in the header responded by the server to ensure the client processes the file type correctly. |
# DownloadTask
API | 说明 |
---|---|
DownloadTask.abort | Interrupt download task |
DownloadTask.onProgressUpdate | 监听Download progress change event |
# Request
API | 说明 |
---|---|
wx.request | Initiate HTTPS network requests. Read Related Instructions before use. |
# RequestTask
API | 说明 |
---|---|
RequestTask.abort | Interrupt request task |
# Upload
API | 说明 |
---|---|
wx.uploadFile | To upload local resources to the developer server, the client initiates a HTTPS POST request in which the value of content-type is multipart/form-data . Read Related Instructions before use. |
# UploadTask
API | 说明 |
---|---|
UploadTask.abort | Interrupt upload task |
UploadTask.onProgressUpdate | 监听Upload progress change event |
# Websocket
API | 说明 |
---|---|
wx.closeSocket | Disable WebSocket connection |
wx.connectSocket | Create a WebSocket connection. Read Related Instructions before use. |
wx.onSocketClose | 监听WebSocket connection disabling event |
wx.onSocketError | 监听WebSocket error event |
wx.onSocketMessage | 监听"WebSocket receives messages from the server" event |
wx.onSocketOpen | 监听WebSocket connection enabling event |
wx.sendSocketMessage | To send data through WebSocket, users first need to call wx.connectSocket, and then callback wx.onSocketOpen. |
# SocketTask
API | 说明 |
---|---|
SocketTask.close | Close WebSocket connection |
SocketTask.onClose | 监听WebSocket connection disabling event |
SocketTask.onError | 监听WebSocket error event |
SocketTask.onMessage | 监听"WebSocket receives messages from the server" event |
SocketTask.onOpen | 监听WebSocket connection enabling event |
SocketTask.send | Send data via WebSocket connection |
# Open API
# Access Token
API | 说明 |
---|---|
auth.getAccessToken | Get Mini Program access_token |
# Anti Addiction
API | 说明 |
---|---|
wx.checkIsUserAdvisedToRest | Determine whether the user needs rest according to the time spent on game play |
# Authorize
API | 说明 |
---|---|
wx.authorize | Initiate authorization requests to users in advance. Immediately after the call, a pop-up is shown to ask the user whether agree to authorize the Mini Program to use a function or get some user data, but the corresponding interface is not actually called. If the user has previously agreed to authorize, there will be no pop-up and success is returned directly. For more instructions, see User Authorization. |
# OpenData Context
API | 说明 |
---|---|
wx.getOpenDataContext | Acquire open data domain |
wx.onMessage | Monitor messages sent by the main domain |
# OpenDataContext
API | 说明 |
---|---|
OpenDataContext.postMessage | Send message to open data domain |
# Customer Message
API | 说明 |
---|---|
wx.openCustomerServiceConversation | Enter a customer service session; it can only be called after the user has triggered at least one touch event. The background access method is the same as that of the Mini Program. See Customer Service Message Access for more |
# Data
API | 说明 |
---|---|
wx.getFriendCloudStorage | Pull the managed data of all playmates of the current user. This interface can only be used under an open data domain |
wx.getGroupCloudStorage | In the case that a Mini Game is opened via the group sharing card, the game data of the group playmates can be obtained by calling the interface. This interface can only be used under an open data domain. |
wx.getSharedCanvas | Only open-data domains can be called, to obtain sharedCanvas shared by the main domain and open-data domain |
wx.getUserCloudStorage | Get the data corresponding to key in the current user managed data. This interface can only be used under an open data domain |
wx.removeUserCloudStorage | Delete the data corresponding to key in the user managed data. |
wx.setUserCloudStorage | Perform data write on user-managed data, allowing simultaneous writing of multiple sets of KV data. |
KVData | |
storage.removeUserStorage | The Mini Game can delete key-value data uploaded to WeChat by this interface |
storage.setUserStorage | Report the background interface of user data. The Mini Game reports key-value data to user's CloudStorage through this interface. |
UserGameData |
# Feedback
API | 说明 |
---|---|
wx.createFeedbackButton | Create "Go to Feedback" button |
# FeedbackButton
API | 说明 |
---|---|
FeedbackButton.destroy | Destroy feedback button |
FeedbackButton.hide | Hide feedback button |
FeedbackButton.offTap | 取消监听Monitor feedback button click event |
FeedbackButton.onTap | 监听Monitor feedback button click event |
FeedbackButton.show | Display feedback button |
# Game Club
API | 说明 |
---|---|
wx.createGameClubButton | Create game hub button. After the game hub button is clicked, it jumps to the Mini Game's game hub. For more information about game hubs, see Game Hub User Guide |
# GameClubButton
API | 说明 |
---|---|
GameClubButton.destroy | Destroy game hub button |
GameClubButton.hide | Hide game hub button |
GameClubButton.offTap | 取消监听Monitor game hub button click event |
GameClubButton.onTap | 监听Monitor game hub button click event |
GameClubButton.show | Display game hub button |
# Login
API | 说明 |
---|---|
wx.checkSession | The user login status obtained through the wx.login interface has a certain timeliness. The longer the user does not use the Mini Program, the more likely the user login state will fail. Otherwise, if the user has been using the Mini Program, the user login state is always valid. The specific timeliness logic is maintained by WeChat and is transparent to developers. Developers only need to call the wx.checkSession interface to check whether the current user login status is valid. After the login status is expired, developers can call wx.login again to get new user login status. A successful call indicates the current session_key is not expired, and a failed call indicates the session_key is expired. See the Mini Program Login for more instructions. |
wx.login | Call the interface to get the login credentials (code) and then exchange the user login state information, including the user's unique identity (openid) and the session key (session_key) of the login. The encryption and decryption communication of user data depends on the session key. See the Mini Program Login for more instructions. |
code2accessToken | To check login credentials, acquire a temporary login credential code via the wx.login() interface, then pass it to the developer server and call the interface to complete the login process. See the Mini Program Login for more instructions. |
# Miniprogram Navigate
API | 说明 |
---|---|
wx.navigateToMiniProgram | Open another Mini Program associated with the same Official Account (note: it must be under the same Official Account and not the same Open Account). It can only be called after the user has triggered at least one touch event. |
# QR-Code
API | 说明 |
---|---|
wxacode.createQRCode | Obtain the Mini Program QR code, suitable for service scenarios that require a small number of codes. Mini Program QR codes generated by this API are permanently valid and limited in quantity. For details, see Obtain QR Code. |
wxacode.get | Obtain the Mini Program code, suitable for service scenarios that require a small number of codes. Mini Program QR codes generated by this API are permanently valid and limited in quantity. For details, see Obtain QR Code. |
wxacode.getUnlimited | Obtain the Mini Program code, suitable for service scenarios that require a large number of codes. **Mini Program QR codes generated by this API are permanently valid and currently not limited in quantity. ** For details, see Obtain QR Code. |
# Security Check
API | 说明 |
---|---|
security.imgSecCheck | Detect whether a photo contains illegal content. Examples of application scenarios: (1) Intelligent detection of pornographic images: detection of photos taken and uploaded by users on tool-type apps related to photo-taking (such as Meipai or picture recognition apps), detection of product pictures on e-commerce platforms, detection of pictures in media users' articles; (2) Sensitive face recognition: users' profile photos, detection of pictures in media users' articles, detection of pictures uploaded by social media users. Frequency limitation: a single appId can be called up to 1,000 times per minute or 100,000 times per day |
security.msgSecCheck | Check whether a text segment contains illegal content. Examples of application scenarios: illegal text detection of users' personal profiles, detection of articles published by media and news users and comments, detection of materials edited and uploaded by game users (such as questions and answers submitted by users on Q&A games). Frequency limitation: a single appId can be called up to 2,000 times per minute or 1,000,000 times per day. |
# Setting
API | 说明 |
---|---|
wx.createOpenSettingButton | Create "Go to Settings" button |
wx.getSetting | Retrieve the user's current settings. Only permissions that the Mini Program has requested from the user will be shown in the return value. |
wx.openSetting | Call up Mini Program Settings interface on the client to return the result of user settings. Only permissions that the Mini Program has requested from the user will be shown in the Settings interface. |
Note: This interface will soon be abandoned. Please use the <button> component to use this feature. | |
AuthSetting |
# OpenSettingButton
API | 说明 |
---|---|
OpenSettingButton.destroy | Destroy "Go to Settings" button |
OpenSettingButton.hide | Hide "Go to Settings" button |
OpenSettingButton.offTap | 取消监听Monitor "Go to Settings" button click event |
OpenSettingButton.onTap | 监听Monitor "Go to Settings" button click event |
OpenSettingButton.show | Display "Go to Settings" button |
# User Info
API | 说明 |
---|---|
wx.createUserInfoButton | Create user information button |
wx.getUserInfo | Get user information. |
UserInfo |
# UserInfoButton
API | 说明 |
---|---|
UserInfoButton.destroy | Destroy user information button |
UserInfoButton.hide | Hide user information button. |
UserInfoButton.offTap | 取消监听Monitor user information button clicking event |
UserInfoButton.onTap | 监听Monitor user information button clicking event |
UserInfoButton.show | Display user information button |
# Werun
API | 说明 |
---|---|
wx.getWeRunData | Retrieving user's WeRun step counts over the last 30 days requires calling the wx.login interface first. |
# Performance
API | 说明 |
---|---|
wx.getPerformance | Acquire performance manager |
wx.triggerGC | Accelerate the triggering of JavaScriptCore Garbage Collection (trash recycling). The GC occasion is controlled by JavaScriptCore. The immediate triggering of GC after calling is not guaranteed. |
# Performance
API | 说明 |
---|---|
Performance.now | It enables you to acquire the timestamp of the current time (in milliseconds) |
# Share
API | 说明 |
---|---|
wx.getShareInfo | Retrieve forwarding details |
wx.hideShareMenu | Hide the forward button |
wx.offShareAppMessage | 取消监听Monitor the event triggered when the user taps the "Forward" button in the upper right menu |
wx.onShareAppMessage | 监听Monitor the event triggered when the user taps the "Forward" button in the upper right menu |
wx.shareAppMessage | Drag to forward and enter the Select from Contacts interface. |
wx.showShareMenu | Display the forward button of the current page |
wx.updateShareMenu | Update forwarding attributes |
# Storage
API | 说明 |
---|---|
wx.clearStorage | Clear local data cache |
wx.clearStorageSync | wx.clearStorage 的同步版本 |
wx.getStorage | Asynchronously acquire the contents of a specified key from the local cache |
wx.getStorageInfo | Asynchronously acquire the relevant information of the current storage |
wx.getStorageInfoSync | wx.getStorageInfo 的同步版本 |
wx.getStorageSync | wx.getStorage 的同步版本 |
wx.removeStorage | Remove the specified key from the local cache |
wx.removeStorageSync | wx.removeStorage 的同步版本 |
wx.setStorage | Storing data in the specified key in the local cache will override the original contents corresponding to the key. |
wx.setStorageSync | wx.setStorage 的同步版本 |
# Subpackages
API | 说明 |
---|---|
wx.loadSubpackage | Trigger sub-package loading; see Sub-package Loading for details |
# LoadSubpackageTask
API | 说明 |
---|---|
LoadSubpackageTask.onProgressUpdate | 监听The sub-package loading progress change event |
# System
# Life Cycle
API | 说明 |
---|---|
wx.exitMiniProgram | Exit current Mini Game |
wx.getLaunchOptionsSync | Return Mini Program startup parameters |
wx.offHide | 取消监听Mini Game hidden to background event. This event will be triggered by locking the screen, pressing the Home key, displaying at the top of Chat, etc. |
wx.offShow | 取消监听Mini Game returns to foreground event |
wx.onHide | 监听Mini Game hidden to background event. This event will be triggered by locking the screen, pressing the Home key, displaying at the top of Chat, etc. |
wx.onShow | 监听Mini Game returns to foreground event |
# System Event
API | 说明 |
---|---|
wx.offAudioInterruptionBegin | 取消监听"Audio interruption begins due to system occupancy" event. The following scenarios will trigger this event: alarms, phone calls, FaceTime calls, WeChat Voice Calls, and WeChat Video Calls. Once this event is triggered, all audios in the Mini Program will be paused. |
wx.offAudioInterruptionEnd | 取消监听"Audio interruption ends" event. After onAudioInterruptionBegin event is received, all audios in the Mini Program will be paused until the receipt of this event |
wx.offError | 取消监听Global error event |
wx.onAudioInterruptionBegin | 监听"Audio interruption begins due to system occupancy" event. The following scenarios will trigger this event: alarms, phone calls, FaceTime calls, WeChat Voice Calls, and WeChat Video Calls. Once this event is triggered, all audios in the Mini Program will be paused. |
wx.onAudioInterruptionEnd | 监听"Audio interruption ends" event. After onAudioInterruptionBegin event is received, all audios in the Mini Program will be paused until the receipt of this event |
wx.onError | 监听Global error event |
# System Info
API | 说明 |
---|---|
wx.getSystemInfo | Acquire system information |
wx.getSystemInfoSync | wx.getSystemInfo 的同步版本 |
# Touch Event
API | 说明 |
---|---|
wx.offTouchCancel | 取消监听Touch point fail event |
wx.offTouchEnd | 取消监听Touch point end event |
wx.offTouchMove | 取消监听Touch point move event |
wx.offTouchStart | 取消监听Start touch event |
wx.onTouchCancel | 监听Touch point fail event |
wx.onTouchEnd | 监听Touch point end event |
wx.onTouchMove | 监听Touch point move event |
wx.onTouchStart | 监听Start touch event |
Touch | Touch object indicates a touch point on a touch-controlled device. Usually refers to an operation by a finger or pen on a touchscreen device or touchpad. |
# Timer
API | 说明 |
---|---|
clearInterval | The timer set by the setInterval() method can be cancelled. |
clearTimeout | The timer set by the setTimeout() method can be cancelled. |
setInterval | Set a timer. Execute the registered callback function according to a set period (in milliseconds) |
setTimeout | Set a timer. When the set time is reached, the registered callback function is executed |
# UI
# Interaction
API | 说明 |
---|---|
wx.hideLoading | Hide loading prompt box |
wx.hideToast | Hide message prompt box |
wx.showActionSheet | |
wx.showLoading | Display loading prompt box, and it needs to call wx.hideLoading actively to close the prompt box |
wx.showModal | Display the modal dialog box |
wx.showToast | Display message prompt box |
# Keyboard
API | 说明 |
---|---|
wx.hideKeyboard | Hide keyboard |
wx.offKeyboardComplete | 取消监听Monitor keyboard retraction event |
wx.offKeyboardConfirm | 取消监听The event for when the user taps "Confirm" button on the keyboard |
wx.offKeyboardInput | 取消监听Keyboard input event |
wx.onKeyboardComplete | 监听Monitor keyboard retraction event |
wx.onKeyboardConfirm | 监听The event for when the user taps "Confirm" button on the keyboard |
wx.onKeyboardInput | 监听Keyboard input event |
wx.showKeyboard | Display keyboard |
wx.updateKeyboard | Update keyboard. Only valid when the keyboard is pulled up |
# Menu
API | 说明 |
---|---|
wx.getMenuButtonBoundingClientRect | Get the layout location information for the menu buttons |
wx.setMenuStyle | Dynamically set the style of the menu pulled up by upper right corner button. |
# Statusbar
API | 说明 |
---|---|
wx.setStatusBarStyle | When showStatusBarStyle is included in the configuration, the status bar appears on the top of the screen This interface can edit the status bar style. |
# Window
API | 说明 |
---|---|
wx.offWindowResize | 取消监听The window size change event |
wx.onWindowResize | 监听The window size change event |
# Update
API | 说明 |
---|---|
wx.getUpdateManager | Acquire globally unique version update manager for managing Mini Program updates. For the update mechanism of Mini Programs, refer to the Operating Mechanism document. |
# UpdateManager
API | 说明 |
---|---|
UpdateManager.applyUpdate | When a new version of a Mini Program is downloaded (i.e. get the onUpdateReady callback), the Mini Program is forced to restart and uses the new version |
UpdateManager.onCheckForUpdate | 监听Request the update results checking event to the WeChat background. WeChat automatically checks updates when Mini programs are cold start, without being triggered by developers. |
UpdateManager.onUpdateFailed | 监听The Mini Program update failure event When there is a new version of a Mini Program, clients will actively trigger downloads (without triggered by developers), and conduct callbacks after downloads fail (possibly due to network reasons, etc.) |
UpdateManager.onUpdateReady | 监听Mini Programs have a version update event. Clients actively trigger downloads (without triggered by developers), and conduct callbacks after downloads succeed. |
# Worker
API | 说明 |
---|---|
wx.createWorker | Create a [Worker thread] (Multi-thread Worker). Currently a maximum of one Worker can only be created, so please call Worker.terminate before creating the next Worker. |
# Worker
API | 说明 |
---|---|
Worker.onMessage | 监听The event of the message sent by the main thread/worker thread to the current thread |
Worker.postMessage | The message sent to the main thread/worker thread |
Worker.terminate | End the current worker thread. The method can only be called on the worker object on the main thread. |