# Widget API
# 1. Basic
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.canIUse | Determines whether the Mini-Program's API, callbacks, parameters, components, etc., are available in the current version | 1.0.0 | |
| ft.base64ToArrayBuffer | Converts a Base64 string to an ArrayBuffer object | 1.0.0 | |
| ft.arrayBufferToBase64 | Converts an ArrayBuffer object to a Base64 string | 1.0.0 |
# 2. System
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.getSystemInfoSync | Synchronous version of ft.getSystemInfo | 1.0.0 | |
| ft.getSystemInfoAsync | Asynchronously get system information | 1.0.0 | |
| ft.getSystemInfo | Get system information | 1.0.0 | |
| ft.openSystemBluetoothSetting | Jump to system Bluetooth settings page | 3.0.45 | iOS:❌ ; Android:✅ |
| ft.openAppAuthorizeSetting | Jump to system authorization management page | 3.0.45 | |
| ft.getWindowInfo | Get window information | 3.0.45 | |
| ft.getSystemSetting | Get device settings | 3.0.45 | |
| ft.getRendererUserAgent | Get UserAgent for Webview Mini-Program | 3.0.45 | |
| ft.getDeviceInfo | Get basic device information | 3.0.45 | |
| ft.getAppBaseInfo | Get APP basic information | 3.0.45 | |
| ft.getAppAuthorizeSetting | Get APP authorization settings | 3.0.45 |
# 3. Update
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.getUpdateManager | Get a globally unique update manager for managing Mini-Program updates | 1.0.0 |
# UpdateManager
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| UpdateManager.applyUpdate | Force the Mini-Program to restart and use the new version | 1.0.0 | |
| UpdateManager.onCheckForUpdate | Listen for events when checking for updates from the FinClip backend | 1.0.0 | |
| UpdateManager.onUpdateFailed | Listen for Mini-Program update failure events | 1.0.0 | |
| UpdateManager.onUpdateReady | Listen for Mini-Program version update events | 1.0.0 |
# 4. Lifecycle
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.getLaunchOptionsSync | Get the parameters when the Mini-Program starts | 1.0.0 | |
| ft.getEnterOptionsSync | Get the parameters for this Mini-Program startup | 1.0.0 |
# 5. Debugging
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.setEnableDebug | Set whether to turn on the debug switch | 1.0.0 |
# console
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| console.debug | Print debug logs to the debugging panel | 1.0.0 | |
| console.error | Print error logs to the debugging panel | 1.0.0 | |
| console.group | Create a new group in the debugging panel | 1.0.0 | |
| console.groupEnd | End the group created by console.group | 1.0.0 | |
| console.info | Print info logs to the debugging panel | 1.0.0 | |
| console.log | Print log messages to the debugging panel | 1.0.0 | |
| console.warn | Print warn logs to the debugging panel | 1.0.0 |
# 6. Timer
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| setTimeout | Set timeout | 1.0.0 | |
| clearTimeout | Clear timeout | 1.0.0 | |
| setInterval | Set interval timer | 1.0.0 | |
| clearInterval | Clear interval timer | 1.0.0 |
# 7. Navigation
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.navigateToMiniProgram | Open a Mini-Program | 1.0.0 |
# 8. Interaction
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.showModal | Display a modal dialog box | 1.0.0 |
# 9. Font
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.loadFontFace | Dynamically load web fonts; file address must be of download type | 1.0.0 |
# 10. Scrolling
# ft.pageScrollTo
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.pageScrollTo | Scroll the page to the target position, supports selector and scroll distance positioning | 1.0.0 |
# ScrollViewContext
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ScrollViewContext | ScrollView operation instance, can be obtained via ft.createSelectorQuery's NodesRef.node method. | 3.0.45 | |
| ScrollViewContext.scrollIntoView | Scroll to the specified position | 3.0.45 | |
| ScrollViewContext.scrollTo | Scroll to the specified position | 3.0.45 |
# 11. Animation
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.createAnimation | Create an animation instance animation | 1.0.0 |
# Animation
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| Animation.export | Export animation queue | 1.0.0 | |
| Animation.step | Indicates that a set of animations is complete | 1.0.0 | |
| Animation.matrix | Same as transform-function matrix | 1.0.0 | |
| Animation.matrix3d | Same as transform-function matrix3d | 1.0.0 | |
| Animation.rotate | Rotate clockwise from the origin by an angle | 1.0.0 | |
| Animation.rotate3d | Rotate clockwise from a fixed axis by an angle | 1.0.0 | |
| Animation.rotateX | Rotate clockwise from the X-axis by an angle | 1.0.0 | |
| Animation.rotateY | Rotate clockwise from the Y-axis by an angle | 1.0.0 | |
| Animation.rotateZ | Rotate clockwise from the Z-axis by an angle | 1.0.0 | |
| Animation.scale | Scale | 1.0.0 | |
| Animation.scale3d | Scale | 1.0.0 | |
| Animation.scaleX | Scale the X-axis | 1.0.0 | |
| Animation.scaleY | Scale the Y-axis | 1.0.0 | |
| Animation.scaleZ | Scale the Z-axis | 1.0.0 | |
| Animation.skew | Skew the X and Y-axis coordinates | 1.0.0 | |
| Animation.skewX | Skew the X-axis coordinate | 1.0.0 | |
| Animation.skewY | Skew the Y-axis coordinate | 1.0.0 | |
| Animation.translate | Translation transformation | 1.0.0 | |
| Animation.translate3d | Translate xyz coordinates | 1.0.0 | |
| Animation.translateX | Translate along the X-axis | 1.0.0 | |
| Animation.translateY | Translate along the Y-axis | 1.0.0 | |
| Animation.translateZ | Translate along the Z-axis | 1.0.0 | |
| Animation.opacity | Set transparency | 1.0.0 | |
| Animation.backgroundColor | Set background color | 1.0.0 | |
| Animation.width | Set width | 1.0.0 | |
| Animation.height | Set height | 1.0.0 | |
| Animation.left | Set left value | 1.0.0 | |
| Animation.right | Set right value | 1.0.0 | |
| Animation.top | Set top value | 1.0.0 | |
| Animation.bottom | Set bottom value | 1.0.0 |
# 12. Window
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.onWindowResize | Listen for window size change events | 1.0.0 | |
| ft.offWindowResize | Cancel listening for window size change events | 1.0.0 |
# 13. Network
# Initiate Request
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.request | Initiate HTTPS network request | 1.0.0 |
# RequestTask
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| RequestTask.abort | Interrupt the request task | 1.0.0 | |
| RequestTask.offHeadersReceived | Remove the listener for HTTP Response Header events | 1.0.0 | |
| RequestTask.onHeadersReceived | Listen for HTTP Response Header events | 1.0.0 |
# Download
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.downloadFile | Download file resources to local storage | 1.0.0 |
# DownloadTask
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| DownloadTask.abort | Interrupt the download task | 1.0.0 | |
| DownloadTask.offHeadersReceived | Remove the listener function for HTTP Response Header events | 1.0.0 | |
| DownloadTask.onHeadersReceived | Listen for HTTP Response Header events. This occurs earlier than the request completion event | 1.0.0 | |
| DownloadTask.offProgressUpdate | Remove the listener function for download progress change events | 1.0.0 | |
| DownloadTask.onProgressUpdate | Listen for download progress change events | 1.0.0 |
# Upload
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.uploadFile | Upload local resources to the server | 1.0.0 |
# UploadTask
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| UploadTask.abort | Interrupt the upload task | 1.0.0 | |
| UploadTask.offHeadersReceived | Remove the listener function for HTTP Response Header events | 1.0.0 | |
| UploadTask.onHeadersReceived | Listen for HTTP Response Header events. This occurs earlier than the request completion event | 1.0.0 | |
| UploadTask.offProgressUpdate | Remove the listener function for upload progress change events | 1.0.0 | |
| UploadTask.onProgressUpdate | Listen for upload progress change events | 1.0.0 |
# WebSocket
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.sendSocketMessage | Send data through a WebSocket connection | 1.0.0 | |
| ft.onSocketOpen | Listen for WebSocket connection open events | 1.0.0 | |
| ft.onSocketMessage | Listen for WebSocket receiving server message events | 1.0.0 | |
| ft.onSocketError | Listen for WebSocket error events | 1.0.0 | |
| ft.onSocketClose | Listen for WebSocket connection close events | 1.0.0 | |
| ft.connectSocket | Create a WebSocket connection | 1.0.0 | |
| ft.closeSocket | Close the WebSocket connection | 1.0.0 |
# SocketTask
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| SocketTask.close | Close the WebSocket connection | 1.0.0 | |
| SocketTask.onClose | Listen for WebSocket connection close events | 1.0.0 | |
| SocketTask.onError | Listen for WebSocket error events | 1.0.0 | |
| SocketTask.onMessage | Listen for WebSocket receiving server message events | 1.0.0 | |
| SocketTask.onOpen | Listen for WebSocket connection open events | 1.0.0 | |
| SocketTask.send | Send data through a WebSocket connection | 1.0.0 |
# 14. Data Storage
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.setStorageSync | Synchronous version of ft.setStorage | 1.0.0 | |
| ft.setStorage | Store data in the local cache at the specified key | 1.0.0 | |
| ft.removeStorageSync | Synchronous version of ft.removeStorage | 1.0.0 | |
| ft.removeStorage | Remove the specified key from the local cache | 1.0.0 | |
| ft.getStorageSync | Synchronous version of ft.getStorage | 1.0.0 | |
| ft.getStorageInfoSync | Synchronous version of ft.getStorageInfo | 1.0.0 | |
| ft.getStorageInfo | Asynchronously get information about the current storage | 1.0.0 | |
| ft.getStorage | Asynchronously get the content of the specified key from the local cache | 1.0.0 | |
| ft.clearStorageSync | Synchronous version of ft.clearStorage | 1.0.0 | |
| ft.clearStorage | Clear local data cache | 1.0.0 | |
| ft.batchSetStorageSync | Batch store data in the local cache at the specified keys | 3.0.49 | |
| ft.batchSetStorage | Batch store data in the local cache at the specified keys | 3.0.49 | |
| ft.batchGetStorageSync | Synchronously batch retrieve the contents of the specified keys from the local cache | 3.0.49 | |
| ft.batchGetStorage | Synchronously batch retrieve the contents of the specified keys from the local cache | 3.0.49 |
# Periodic Updates
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.setBackgroundFetchToken | Set custom login status, included during periodic data fetching, to facilitate third-party server validation of request legitimacy | Supported from Base Library 3.2.1 | |
| ft.onBackgroundFetchData | Listen for callbacks upon receiving backgroundFetch data | Supported from Base Library 3.2.1 | |
| ft.getBackgroundFetchToken | Retrieve the set custom login status | Supported from Base Library 3.2.1 | |
| ft.getBackgroundFetchData | Fetch backgroundFetch client-side cached data | Supported from Base Library 3.2.1 |
# 15. Canvas
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.canvasToTempFilePath | Export the content of the specified area of the current canvas as an image of the specified size | 1.0.0 | |
| ft.canvasPutImageData | Draw pixel data onto the canvas | 1.0.0 | |
| ft.canvasGetImageData | Get the pixel data hidden in the canvas region | 1.0.0 |
# Canvas
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| Canvas.createImage | Create an image object, only available for canvas obtained via createSelectorQuery | 1.0.0 | |
| Canvas.getContext | This method returns the drawing context of the Canvas | 1.0.0 | |
| Canvas.createImageData | Create an ImageData object | 1.0.0 |
# CanvasContext
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| CanvasContext.arc | Create an arc | 1.0.0 | |
| CanvasContext.arcTo | Draw an arc path based on control points and radius | 1.0.0 | |
| CanvasContext.beginPath | Start creating a path | 1.0.0 | |
| CanvasContext.clearRect | Clear the content within the rectangular area on the canvas | 1.0.0 | |
| CanvasContext.drawImage | Draw an image onto the canvas | 1.0.0 | |
| CanvasContext.createCircularGradient | Create a circular | ||
| Name | Function Description | Version | Remarks |
| --- | --- | --- | --- |
| OffscreenCanvas.createImage | Creates an image object | 1.0.0 | |
| OffscreenCanvas.getContext | This method returns the drawing context of OffscreenCanvas | 1.0.0 |
# 16. Map
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.createMapContext | Creates a MapContext object for the map | 1.0.0 |
# MapContext
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| MapContext.addArc | Adds an arc; either waypoints or angle must be set | Not Supported | |
| MapContext.addCustomLayer | Adds a personalized layer | Not Supported | |
| MapContext.addGroundOverlay | Creates a custom image layer that scales with the map | Not Supported | |
| MapContext.addVisualLayer | Adds a visual layer | Not Supported | |
| MapContext.addMarkers | Adds markers | 1.0.0 | |
| MapContext.fromScreenLocation | Gets the latitude and longitude corresponding to a point on the screen, with the origin at the top-left corner of the map | 1.0.0 | |
| MapContext.getCenterLocation | Gets the current center latitude and longitude of the map | 1.0.0 | |
| MapContext.getRegion | Gets the current visible region of the map | 1.0.0 | |
| MapContext.getRotate | Gets the current rotation angle of the map | 1.0.0 | |
| MapContext.getSkew | Gets the current tilt angle of the map | 1.0.0 | |
| MapContext.getScale | Gets the current zoom level of the map | 1.0.0 | |
| MapContext.includePoints | Zooms the view to display all specified latitudes and longitudes | 1.0.0 | |
| MapContext.initMarkerCluster | Initializes marker clustering configuration; default configuration is used if not called | 1.0.0 | |
| MapContext.moveAlong | Moves a marker along a specified path, useful for trajectory playback scenarios | 1.0.0 | |
| MapContext.moveToLocation | Moves the map center to the current location; requires setting the map component's show-location to true | 1.0.0 | |
| MapContext.openMapApp | Launches the map app for navigation selection | 1.0.0 | |
| MapContext.removeCustomLayer | Removes a personalized layer | Not Supported | |
| MapContext.removeGroundOverlay | Removes a custom image layer | Not Supported | |
| MapContext.removeMarkers | Removes markers | 1.0.0 | |
| MapContext.removeVisualLayer | Removes a visual layer | Not Supported | |
| MapContext.setBoundary | Restricts the display range of the map | Not Supported | |
| MapContext.setCenterOffset | Sets the map center offset; increases backward and downward; screen ratio range (0.25~0.75); default offset [0.5, 0.5] | 1.0.0 | |
| MapContext.setLocMarkerIcon | Sets the location marker icon; supports network paths, local paths, and code package paths | 1.0.0 | |
| MapContext.toScreenLocation | Gets the screen coordinates corresponding to latitude and longitude, with the origin at the top-left corner of the map | 1.0.0 | |
| MapContext.translateMarker | Translates a marker with animation | 1.0.0 | |
| MapContext.updateGroundOverlay | Updates a custom image layer | Not Supported | |
| MapContext.on | Listens for map events | 1.0.0 |
# 17. Image
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.saveImageToPhotosAlbum | Saves an image to the system album | 1.0.0 | |
| ft.previewMedia | Previews images and videos | 1.0.0 | |
| ft.previewImage | Full-screen previews images in a new page | 1.0.0 | |
| ft.getImageInfo | Retrieves image information | 1.0.0 | |
| ft.compressImage | Compresses an image with optional quality settings | 1.0.0 |
# 18. Video
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.saveVideoToPhotosAlbum | Saves a video to the system album | 1.0.0 | |
| ft.compressVideo | Compresses a video | 1.0.0 | |
| ft.previewVideo | Previews a video | 1.0.0 | |
| ft.getVideoInfo | Retrieves detailed video information | 3.1.17 |
# 19. Audio
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.stopVoice | Stops voice playback | 1.0.0 | |
| ft.setInnerAudioOption | Sets playback options for InnerAudioContext | 1.0.0 | |
| ft.playVoice | Starts voice playback | 1.0.0 | |
| ft.pauseVoice | Pauses ongoing voice playback | 1.0.0 | |
| ft.createInnerAudioContext | Creates an InnerAudioContext object | 1.0.0 | |
| ft.createAudioContext | Creates an AudioContext object | 1.0.0 | |
| ft.getAvailableAudioSources | Retrieves currently supported audio input sources | 3.1.7 | Returns a fixed value 'auto' in development tools |
# audiocontext
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| audiocontext.setSrc | Sets the audio source | 1.0.0 | |
| audiocontext.play | Plays audio | 1.0.0 | |
| audiocontext.pause | Pauses audio | 1.0.0 | |
| audiocontext.seek | Jumps to a specified position | 1.0.0 |
# InnerAudioContext
Note: iOS does not support this feature yet.
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| InnerAudioContext.destroy | Destroys the current instance | 1.0.0 | |
| InnerAudioContext.offCanplay | Cancels listening for the event when audio becomes playable | 1.0.0 | |
| InnerAudioContext.offEnded | Cancels listening for the event when audio naturally ends | 1.0.0 | |
| InnerAudioContext.offError | Cancels listening for audio playback error events | 1.0.0 | |
| InnerAudioContext.offTimeUpdate | Cancels listening for audio playback progress update events | 1.0.0 | |
| InnerAudioContext.offSeeking | Cancels listening for audio seeking operation events | 1.0.0 | |
| InnerAudioContext.offWaiting | Cancels listening for audio loading events | 1.0.0 | |
| InnerAudioContext.onEnded | Listens for the event when audio naturally ends | 1.0.0 | |
| InnerAudioContext.offPlay | Cancels listening for audio playback events | 1.0.0 | |
| InnerAudioContext.onCanplay | Listens for the event when audio becomes playable | 1.0.0 | |
| InnerAudioContext.onPause | Listens for audio pause events | 1.0.0 | |
| InnerAudioContext.offPause | Cancels listening for audio pause events | 1.0.0 | |
| InnerAudioContext.offSeeked | Cancels listening for audio seek completion events | 1.0.0 | |
| InnerAudioContext.offStop | Cancels listening for audio stop events | 1.0.0 | |
| InnerAudioContext.onError | Listens for audio playback error events | 1.0.0 | |
| InnerAudioContext.onPlay | Listens for audio playback events | 1.0.0 | |
| InnerAudioContext.onSeeked | Listens for audio seek completion events | 1.0.0 | |
| InnerAudioContext.onSeeking | Listens for audio seeking operation events | 1.0.0 | |
| InnerAudioContext.onStop | Listens for audio stop events | 1.0.0 | |
| InnerAudioContext.onTimeUpdate | Listens for audio playback progress update events | 1.0.0 | |
| InnerAudioContext.onWaiting | Listens for audio loading events | 1.0.0 | |
| InnerAudioContext.pause | Pauses | 1.0.0 | |
| InnerAudioContext.play | Plays | 1.0.0 | |
| InnerAudioContext.seek | Jumps to a specified position | 1.0.0 | |
| InnerAudioContext.stop | Stops | 1.0.0 |
# 20. Background Audio
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.stopBackgroundAudio | Stops music playback | 1.0.0 | |
| ft.seekBackgroundAudio | Controls music playback progress | 1.0.0 | |
| ft.playBackgroundAudio | Plays music using the background player | 1.0.0 | |
| ft.pauseBackgroundAudio | Pauses music playback | 1.0.0 | |
| ft.onBackgroundAudioStop | Listens for music stop events | 1.0.0 | |
| ft.onBackgroundAudioPlay | Listens for music playback events | 1.0.0 | |
| ft.onBackgroundAudioPause | Listens for music pause events | 1.0.0 | |
| ft.getBackgroundAudioPlayerState | Retrieves the state of background music playback | 1.0.0 | |
| ft.getBackgroundAudioManager | Retrieves the globally unique background audio manager. If the Mini-Program enters the background while audio is playing, playback can continue. However, the playback state cannot be manipulated via API calls while in the background. | 2.12.12 |
# backgroundaudiomanager
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| backgroundaudiomanager.onCanplay | Listens for the event when background audio becomes playable | 1.0.0 | |
| backgroundaudiomanager.onEnded | Listens for the event when background audio naturally ends | 1.0.0 | |
| BackgroundAudioManager.onError | Listens for background audio playback error events | 1.0.0 | |
| backgroundaudiomanager.onNext | Listens for the event when the user clicks the next track button on the system music playback panel (iOS only) | 1.0.0 | |
| backgroundaudiomanager.onPause | Listens for background audio pause events | 1.0.0 | |
| backgroundaudiomanager.onPlay | Listens for background audio playback events | 1.0.0 | |
| backgroundaudiomanager.onPrev | Listens for the event when the user clicks the previous track button on the system music playback panel (iOS only) | 1.0.0 | |
| backgroundaudiomanager.onSeeked | Listens for the event when background audio completes a seek operation | 1.0.0 | |
| backgroundaudiomanager.onSeeking | Listens for the event when background audio starts a seek operation | 1.0.0 | |
| backgroundaudiomanager.onStop | Listens for background audio stop events | 1.0.0 | |
| backgroundaudiomanager.onTimeUpdate | Listens for background audio playback progress update events; callbacks are triggered only when the Mini-Program is in the foreground | 1.0.0 | |
| backgroundaudiomanager.onWaiting | Listens for audio loading events | 1.0.0 | |
| backgroundaudiomanager.pause | Pauses music | 1.0.0 | |
| backgroundaudiomanager.play | Plays music | 1.0.0 | |
| backgroundaudiomanager.seek | Jumps to a specified position | 1.0.0 | |
| backgroundaudiomanager.stop | Stops music | 1.0.0 |
# 21. Rich Text
# EditorContext
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| EditorContext.focus | Focuses the editor; note that due to system limitations on iOS, the focus method may not work properly | 3.9.4 | |
| EditorContext.blur | Defocuses the editor and hides the keyboard | 1.0.0 | |
| EditorContext.clear | Clears the editor content | 1.0.0 | |
| EditorContext.format | Modifies styles | 1.0.0 | |
| EditorContext.getContents | Retrieves the editor content | 1.0.0 | |
| EditorContext.getSelectionText | Retrieves the plain text content within the selected area of the editor | 1.0.0 | |
| EditorContext.insertDivider | Inserts a divider | 1.0.0 | |
| EditorContext.insertImage | Inserts an image | 1.0.0 | |
| EditorContext.insertText | Overwrites the current selection with a block of text | 1.0.0 | |
| EditorContext.redo | Redoes the last action | 1.0.0 | |
| EditorContext.removeFormat | Clears the formatting of the current selection | 1.0.0 | |
| EditorContext.scrollIntoView | Scrolls the editor cursor into the visible area of the window | 1.0.0 | |
| EditorContext.setContents | Initializes the editor content; if both HTML and delta are present, only delta takes effect | 1.0.0 | |
| EditorContext.undo | Undoes the last action | 1.0.0 | |
| EditorContext.insertCustomBlock | Inserts a custom block | 3.10.1 |
# 22. File
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.saveFile | Saves a file locally | 1.0.0 | |
| ft.removeSavedFile | Deletes a locally cached file | 1.0.0 | |
| ft.openDocument | Opens a document in a new page | 1.0.0 | |
| ft.getSavedFileList | Retrieves the list of locally cached files saved under this Mini-Program | 1.0.0 | |
| ft.getSavedFileInfo | Retrieves file information for a local file | 1.0.0 | |
| ft.getFileSystemManager | Retrieves the globally unique file manager | 1.0.0 | |
| ft.getFileInfo | Retrieves file information | 1.0.0 | |
| ft.saveFileToDisk | Saves a file from the file system to the user's disk; supported only on PC | 1.0.0 |
# FileSystemManager
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| FileSystemManager.accessSync | Checks if a file/directory exists | 1.0.0 | |
| FileSystemManager.access | Checks if a file/directory exists | 1.0.0 | |
| FileSystemManager.appendFile | Appends content to the end of a file | 1.0.0 | |
| FileSystemManager.appendFileSync | Synchronous version of FileSystemManager.appendFile | 1.0.0 | |
| FileSystemManager.close | Closes a file | 1.0.0 | |
| FileSystemManager.closeSync | Synchronously closes a file | 1.0.0 | |
| FileSystemManager.copyFile | Copies a file | 1.0.0 | |
| FileSystemManager.copyFileSync | Synchronous version of FileSystemManager.copyFile | 1.0.0 | |
| FileSystemManager.getFileInfo | Retrieves information about a local temporary file or local cached file under this Mini-Program | 1.0.0 | |
| FileSystemManager.getSavedFileList | Retrieves the list of locally cached files saved under this Mini-Program | 1.0.0 | |
| FileSystemManager.mkdir | Creates a directory | 1.0.0 | |
| FileSystemManager.mkdirSync | Synchronous version of FileSystemManager.mkdir | 1.0.0 | |
| FileSystemManager.readdir | Reads the list of files in a directory | 1.0.0 | |
| FileSystemManager.readdirSync | Synchronous version of FileSystemManager.readdir | 1.0.0 | |
| FileSystemManager.readFile | Reads local file content | 1.0.0 | |
| FileSystemManager.readFileSync | Synchronous version of FileSystemManager.readFile | 1.0.0 | |
| FileSystemManager.removeSavedFile | Deletes a locally cached file saved under this Mini-Program | 1.0.0 | |
| FileSystemManager.rename | Renames a file | 1.0.0 | |
| FileSystemManager.renameSync | Synchronous version of FileSystemManager.rename | 1.0.0 | |
| FileSystemManager.rmdir | Deletes a directory | 1.0.0 | |
| FileSystemManager.rmdirSync | Synchronous version of FileSystemManager.rmdir | 1.0.0 | |
| FileSystemManager.saveFile | Saves a temporary file locally | 1.0.0 | |
| FileSystemManager.saveFileSync | Synchronous version of FileSystemManager.saveFile | 1.0.0 | |
| FileSystemManager.stat | Retrieves a Stats object for a file | 1.0.0 | |
| FileSystemManager.statSync | Synchronous version of FileSystemManager.stat | 1.0.0 | |
| FileSystemManager.unlink | Deletes a file | 1.0.0 | |
| FileSystemManager.unlinkSync | Synchronous version of FileSystemManager.unlink | 1.0.0 | |
| FileSystemManager.unzip | Unzips a file | 1.0.0 | |
| FileSystemManager.writeFile | Writes to a file | 1.0.0 | |
| FileSystemManager.writeFileSync | Synchronous version of FileSystemManager.writeFile | 1.0.0 | |
| FileSystemManager.write | Writes to a file | 1.0.0 | |
| FileSystemManager.writeSync | Synchronous version of FileSystemManager.write | 1.0.0 | |
| FileSystemManager.fstat | Retrieves file status information | 1.0.0 | |
| FileSystemManager.fstatSync | Synchronously retrieves file status information | 1.0.0 | |
| FileSystemManager.ftruncate | Truncates file content | 1.0.0 | |
| FileSystemManager.ftruncateSync | Truncates file content | 1.0.0 | |
| FileSystemManager.open | Opens a file and returns a file descriptor | 1.0.0 | |
| FileSystemManager.openSync | Synchronously opens a file and returns a file descriptor | 1.0.0 | |
| FileSystemManager.read | Reads a file | 1.0.0 | |
| FileSystemManager.readCompressedFile | Reads the content of a local file with a specified compression type | 1.0.0 | |
| FileSystemManager.readCompressedFileSync | Synchronously reads the content of a local file with a specified compression type | 1.0.0 | |
| FileSystemManager.readSync | Reads a file | 1.0.0 | |
| FileSystemManager.readZipEntry | Reads a file inside a zip archive | 1.0.0 | |
| FileSystemManager.truncate | Truncates file content | 1.0.0 | |
| FileSystemManager.truncateSync | Truncates file content (synchronous version of truncate) | 1.0.0 | |
| ReadResult | File read result | 1.0.0 |
# Stats
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| Stats.isDirectory | Determines if the current file is a directory | 1.0.0 | |
| Stats.isFile | Determines if the current file is a regular file | 1.0.0 | |
| WriteResult | File write result | 1.0.0 |
# 23. Encryption
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.getRandomValues | Retrieves cryptographically secure random values | 1.0.0 |
# 24. Screen
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.setScreenBrightness | Sets screen brightness | 1.0.0 | |
| ft.setKeepScreenOn | Sets whether to keep the screen on | 1.3.9 | |
| ft.onUserCaptureScreen | Listens for user-initiated screenshot events | 1.0.0 | Not supported on iOS |
| ft.offUserCaptureScreen | User-initiated screenshot event | 1.0.0 | Not supported on iOS |
| ft.getScreenBrightness | Retrieves screen brightness | 1.0.0 |
# 25. Gyroscope
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.stopGyroscope | Stops listening for gyroscope data | 3.0.46 | |
| ft.startGyroscope | Starts listening for gyroscope data | 3.0.46 | |
| ft.onGyroscopeChange | Listens for gyroscope data change events | 3.0.46 | |
| ft.offGyroscopeChange | Cancels listening for gyroscope data change events | 3.0.46 |
# 26. Vibration
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.vibrateShort | Causes the phone to vibrate briefly (15 ms) | 1.0.0 | |
| ft.vibrateLong | Causes the phone to vibrate for a longer duration (400 ms) | 1.0.0 |
# 27. FXML
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| ft.createSelectorQuery | Returns a SelectorQuery object instance | 1.0.0 | |
| ft.createIntersectionObserver | Creates and returns an IntersectionObserver object instance | 1.0.0 |
# IntersectionObserver
| Name | Function Description | Version | Remarks |
|---|---|---|---|
| IntersectionObserver.disconnect | Stops listening | 1.0.0 | |
| [IntersectionObserver |