English
chooseImage
About 118 wordsLess than 1 minute
2025-12-16
Adapter for image selection capability
Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| opts | Object | Yes | Configuration options object |
| opts.onSuccess | Function | Yes | Success callback function, receives an array of file streams |
Return Value
No return value. The selection result is returned through the callback function.
Success Callback Parameters (onSuccess)
| Parameter Name | Type | Description |
|---|---|---|
| files | Array | Array of images in file-stream format |
Usage Example
chooseImage(opts) {
// Call the native image-selection capability of the third-party app
window.xx.chooseImage().then((files) => {
// files are in file-stream format
opts.onSuccess(files);
}).catch((error) => {
console.error('Failed to choose image:', error);
});
}The third-party app provides a native image selection API and returns a Promise object.
