Globals / MiniAppFeatures
Interface: MiniAppFeatures
A module layer for webapps and mobile native interaction.
Hierarchy
- MiniAppFeatures
Implemented by
Index
Methods
- downloadFile
- getHostEnvironmentInfo
- getMauid
- getMessagingUniqueId
- getPoints
- getUniqueId
- requestCustomPermissions
- requestLocationPermission
- setCloseAlert
- setScreenOrientation
- shareInfo
Methods
downloadFile
▸ downloadFile(filename
: string, url
: string, headers?
: DownloadFileHeaders): Promise<string>
Defined in js-miniapp-sdk/src/miniapp.ts:111
Request to download a file and save to the user’s device.
Parameters:
Name | Type |
---|---|
filename |
string |
url |
string |
headers? |
DownloadFileHeaders |
Returns: Promise<string>
Promise of the downloaded files name. Response will be null
in case the user cancelled the download.
Can be rejected with MiniAppError, DownloadFailedError, DownloadHttpError, InvalidUrlError, or SaveFailureError.
getHostEnvironmentInfo
▸ getHostEnvironmentInfo(): Promise<HostEnvironmentInfo>
Defined in js-miniapp-sdk/src/miniapp.ts:104
Request the host environment information.
Returns: Promise<HostEnvironmentInfo>
Promise of the provided environment info from mini app.
getMauid
▸ getMauid(): Promise<string>
Defined in js-miniapp-sdk/src/miniapp.ts:53
Request the mini app’s mauid from the host app.
Returns: Promise<string>
The Promise of provided id of mini app from injected side.
getMessagingUniqueId
▸ getMessagingUniqueId(): Promise<string>
Defined in js-miniapp-sdk/src/miniapp.ts:47
Request the mini app’s messaging unique id from the host app.
Returns: Promise<string>
The Promise of provided id of mini app from injected side.
getPoints
▸ getPoints(): Promise<Points>
Defined in js-miniapp-sdk/src/miniapp.ts:98
Request the point balance from the host app.
Returns: Promise<Points>
Promise of the provided point balance from mini app.
getUniqueId
▸ getUniqueId(): Promise<string>
Defined in js-miniapp-sdk/src/miniapp.ts:41
deprecated
Use getMessagingUniqueId
or getMauid
instead
Request the mini app’s unique id from the host app.
Returns: Promise<string>
The Promise of provided id of mini app from injected side.
requestCustomPermissions
▸ requestCustomPermissions(permissions
: CustomPermission[]): Promise<CustomPermissionResult[]>
Defined in js-miniapp-sdk/src/miniapp.ts:75
Request that the user grant custom permissions related to accessing user data. Typically, this will show a dialog in the Host App asking the user grant access to your Mini App. You can pass multiple permissions at once and the Host App will request all of those permissions within a single dialog.
Parameters:
Name | Type | Description |
---|---|---|
permissions |
CustomPermission[] | An array containing CustomPermission objects - permission name and description |
Returns: Promise<CustomPermissionResult[]>
Promise with the custom permission results - “ALLOWED” or “DENIED” for each permission
requestLocationPermission
▸ requestLocationPermission(permissionDescription?
: string): Promise<string>
Defined in js-miniapp-sdk/src/miniapp.ts:64
Request the location permission from the host app.
You must call this before using navigator.geolocation
.
This will request both the Android/iOS device permission for location (if not yet granted to the host app),
and the custom permission for location CustomPermissionName.LOCATION.
Parameters:
Name | Type | Description |
---|---|---|
permissionDescription? |
string | Description of location permission. |
Returns: Promise<string>
The Promise of permission result of mini app from injected side. Rejects the promise if the user denied the location permission (either the device permission or custom permission).
setCloseAlert
▸ setCloseAlert(alertInfo
: CloseAlertInfo): Promise<string>
Defined in js-miniapp-sdk/src/miniapp.ts:120
Mini App can choose whether to display Close confirmation alert dialog when mini app is closed
Parameters:
Name | Type |
---|---|
alertInfo |
CloseAlertInfo |
Returns: Promise<string>
setScreenOrientation
▸ setScreenOrientation(screenOrientation
: ScreenOrientation): Promise<string>
Defined in js-miniapp-sdk/src/miniapp.ts:92
Swap and lock the screen orientation. There is no guarantee that all hostapps and devices allow the force screen change so MiniApp should not rely on this.
Parameters:
Name | Type | Description |
---|---|---|
screenOrientation |
ScreenOrientation | The action that miniapp wants to request on device. |
Returns: Promise<string>
The Promise of screen action state from injected side.
shareInfo
▸ shareInfo(info
: ShareInfoType): Promise<string>
Defined in js-miniapp-sdk/src/miniapp.ts:84
Share text and image with another App or with the host app.
Parameters:
Name | Type | Description |
---|---|---|
info |
ShareInfoType | The shared data must match the property in [ShareInfoType]. |
Returns: Promise<string>
The Promise of share info action state from injected side.