js-miniapp-sdk

Globals / MiniAppFeatures

Interface: MiniAppFeatures

A module layer for webapps and mobile native interaction.

Hierarchy

Implemented by

Index

Methods

Methods

getPoints

getPoints(): Promise<Points>

Defined in js-miniapp-sdk/src/miniapp.ts:69

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:24

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:46

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:35

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).


setScreenOrientation

setScreenOrientation(screenOrientation: ScreenOrientation): Promise<string>

Defined in js-miniapp-sdk/src/miniapp.ts:63

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:55

Share text data 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.