2.37.3 • Published 6 days ago

zmp-sdk v2.37.3

Weekly downloads
148
License
MIT
Repository
-
Last release
6 days ago

ZaloMiniAppSDK

Zalo Mini apps SDK. Contains all methods separated by categories

Table of contents

Authentication Methods

Basics Methods

Data Caching Methods

Device Methods

Navigation Bar Methods

Open APIs Methods

Usage

import apis from 'zmp-sdk;

Authentication Methods

getAccessToken

getAccessToken(): Promise<any>

Get Access Token.

async

function getAccessToken

example apis.getAccessToken().then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Returns: Promise<any>


login

login(): Promise<any>

Login to call more action.

async

function Login

example apis.login().then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Returns: Promise<any>


Basics Methods

getVersion

getVersion(): string

Get the current version of sdk.

Returns: string

Zalo Mini App version.


Data Caching Methods

clearStorage

clearStorage(option: ClearStorageDataType): Promise<any>

Clears the data cached locally.

async

function clearStorage

example apis.clearStorage({ prefix: "prefix" // optional }).then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Parameters:

NameType
optionClearStorageDataType

Returns: Promise<any>


getStorage

getStorage(object: GetStorageDataType): Promise<any>

Asynchronously gets the content of the specified key from the local cache.

async

function getStorage

example apis.getStorage({ key: "key", isPrefix: false }).then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Parameters:

NameType
objectGetStorageDataType

Returns: Promise<any>


getStorageInfo

getStorageInfo(): Promise<any>

Asynchronously gets the information related to the current storage.

async

function getStorageInfo

example apis.getStorageInfo().then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Returns: Promise<any>


removeStorage

removeStorage(object: RemoveStorageDataType): Promise<any>

Removes the specified key from the local cache.

async

function removeStorage

example apis.removeStorage({ key: 'key' }).then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Parameters:

NameType
objectRemoveStorageDataType

Returns: Promise<any>


setStorage

setStorage(object: SetStorageDataType): Promise<any>

Stores data in the specified key in the local cache. This operation will overwrite the original content of the key.

async

function setStorage

example apis.setStorage({ key: "key", data: "value" }).then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Parameters:

NameType
objectSetStorageDataType

Returns: Promise<any>


Device Methods

getNetworkType

getNetworkType(): Promise<NetworkTypeSuccessCallback>

Gets the network type.

async

function getNetworkType

example zmpApis.getNetworkType().then((res) => { console.log(res.networkType); }).catch((error) => { console.log("Fail"); });

Returns: Promise<NetworkTypeSuccessCallback>

Promise object


setDeviceOrientation

setDeviceOrientation(object: DeviceOrientationType): Promise<any>

Sets the color of the navigation bar in the page.

async

function setDeviceOrientation

example apis.setDeviceOrientation({ rotate: 0 }).then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Parameters:

NameType
objectDeviceOrientationType

Returns: Promise<any>


Navigation Bar Methods

setNavigationBarColor

setNavigationBarColor(object: NavBarColorType): Promise<any>

Sets the color of the navigation bar in the page.

async

function setNavigationBarColor

example apis.setNavigationBarColor({ color: "#000000" }).then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Parameters:

NameType
objectNavBarColorType

Returns: Promise<any>


setNavigationBarLeftButton

setNavigationBarLeftButton(object: NavBarLeftMenuType): Promise<any>

Dynamically sets the left button of the current page.

async

function setNavigationBarLeftButton

example apis.setNavigationBarLeftButton({ buttonType: 1, confirmToExit: 1, dialogMessage: 'Bạn có muốn đóng app này không?' }).then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Parameters:

NameType
objectNavBarLeftMenuType

Returns: Promise<any>


setNavigationBarTitle

setNavigationBarTitle(object: NavBarTitleType): Promise<any>

Dynamically sets the title of the current page.

async

function setNavigationBarTitle

example

apis.setNavigationBarTitle({ title: "Current Page" }).then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Parameters:

NameType
objectNavBarTitleType

Returns: Promise<any>


Open APIs Methods

getUserInfo

getUserInfo(): Promise<any>

Gets user information

async

function getUserInfo

example apis.getUserInfo().then((res) => { console.log("Success"); }).catch((error) => { console.log("Fail"); });

Returns: Promise<any>

2.37.4-0

6 days ago

2.37.3

13 days ago

2.37.2

14 days ago

2.37.2-rc.0

1 month ago

2.37.1

1 month ago

2.37.1-rc.0

1 month ago

2.37.1-payment.0

1 month ago

2.37.0-rc.1

1 month ago

2.37.0-rc.0

1 month ago

2.36.0

2 months ago

2.35.5

2 months ago

2.35.4

3 months ago

2.35.3

3 months ago

2.35.2-beta.0

3 months ago

2.35.1

3 months ago

2.35.2

3 months ago

2.34.2

4 months ago

2.34.3

4 months ago

2.35.0

4 months ago

2.35.0-beta.1

4 months ago

2.35.0-beta.0

4 months ago

2.34.1

4 months ago

2.34.0

4 months ago

2.33.1

5 months ago

2.33.0

5 months ago

2.32.5

5 months ago

2.32.0-rc.0

6 months ago

2.32.0

6 months ago

2.32.2

6 months ago

2.32.1

6 months ago

2.32.4

5 months ago

2.32.3

5 months ago

2.31.1

6 months ago

2.31.0

6 months ago

2.31.2

6 months ago

2.30.4

6 months ago

2.31.0-beta.0

6 months ago

2.30.2

7 months ago

2.30.1

7 months ago

2.30.3

7 months ago

2.28.1-rc.0

10 months ago

2.29.0

7 months ago

2.28.0-rc.0

11 months ago

2.28.3-rc.0

9 months ago

2.28.9

8 months ago

2.28.8

8 months ago

2.28.5

8 months ago

2.28.4

9 months ago

2.28.7

8 months ago

2.28.6

8 months ago

2.28.1

10 months ago

2.28.0

10 months ago

2.28.3

9 months ago

2.28.2

9 months ago

2.27.2

11 months ago

2.27.1

12 months ago

2.30.0

7 months ago

2.23.4

1 year ago

2.26.0-rc.0

1 year ago

2.26.0-rc.1

1 year ago

2.25.1-rc.0

1 year ago

2.27.0

12 months ago

2.26.3

1 year ago

2.26.2

1 year ago

2.26.5

1 year ago

2.26.4

1 year ago

2.26.1

1 year ago

2.26.0

1 year ago

2.25.0-rc.0

1 year ago

2.25.0-rc.12

1 year ago

2.25.0-rc.11

1 year ago

2.27.1-rc.1

12 months ago

2.26.2-rc.0

1 year ago

2.25.7

1 year ago

2.25.4

1 year ago

2.25.3

1 year ago

2.25.6

1 year ago

2.25.5

1 year ago

2.25.0

1 year ago

2.25.2

1 year ago

2.25.1

1 year ago

2.25.0-rc.1

1 year ago

2.25.0-rc.2

1 year ago

2.25.0-rc.3

1 year ago

2.25.0-rc.4

1 year ago

2.25.0-rc.5

1 year ago

2.25.0-rc.6

1 year ago

2.25.0-rc.7

1 year ago

2.23.5-rc.0

1 year ago

2.25.0-rc.8

1 year ago

2.23.5-rc.1

1 year ago

2.25.0-rc.9

1 year ago

2.24.0

1 year ago

2.25.7-rc.0

1 year ago

2.23.2

1 year ago

2.23.1

2 years ago

2.23.3

1 year ago

2.23.4-0

1 year ago

2.23.2-1

1 year ago

2.23.2-0

1 year ago

2.23.1-0

2 years ago

2.23.0-rc.1

2 years ago

2.23.0-rc.2

2 years ago

2.22.3

2 years ago

2.23.0-0

2 years ago

2.23.0

2 years ago

2.19.2

2 years ago

2.19.0

2 years ago

2.19.1

2 years ago

2.22.1

2 years ago

2.22.0

2 years ago

2.22.2

2 years ago

2.21.0

2 years ago

2.21.2

2 years ago

2.21.1

2 years ago

2.20.0

2 years ago

2.19.0-rc.7

2 years ago

2.19.0-rc.6

2 years ago

2.21.0-rc

2 years ago

2.18.9

2 years ago

2.18.7

2 years ago

2.18.8

2 years ago

2.19.0-rc.5

2 years ago

2.19.0-rc.4

2 years ago

2.19.0-rc.3

2 years ago

2.18.10

2 years ago

2.17.6-0

2 years ago

2.17.6-1

2 years ago

2.18.5

2 years ago

2.18.6

2 years ago

2.18.3

2 years ago

2.18.4

2 years ago

2.18.1

2 years ago

2.18.2

2 years ago

2.18.0

2 years ago

2.18.5-rc.0

2 years ago

2.18.5-rc.1

2 years ago

2.17.0-rc.2

2 years ago

2.17.0-rc.0

2 years ago

2.17.0-rc.1

2 years ago

2.17.6

2 years ago

2.17.7

2 years ago

2.17.4

2 years ago

2.17.5

2 years ago

2.17.2

2 years ago

2.17.3

2 years ago

2.17.0

2 years ago

2.17.1

2 years ago

2.16.7

2 years ago

2.16.8

2 years ago

2.16.6

2 years ago

2.19.0-rc.2

2 years ago

2.19.0-rc.1

2 years ago

2.19.0-rc.0

2 years ago

2.18.0-rc.0

2 years ago

2.16.5

2 years ago

2.16.4

2 years ago

2.15.0-rc.1

2 years ago

2.15.4

2 years ago

2.15.2

2 years ago

2.15.3

2 years ago

2.15.0

2 years ago

2.15.1

2 years ago

2.15.0-1

2 years ago

2.14.5

2 years ago

2.14.3

2 years ago

2.14.4

2 years ago

2.16.0-rc.0

2 years ago

2.16.3

2 years ago

2.16.1

2 years ago

2.16.2

2 years ago

2.16.0

2 years ago

2.15.0-rc.2

2 years ago

2.15.0-rc.3

2 years ago

2.15.0-rc.4

2 years ago

2.15.0-rc.5

2 years ago

2.15.0-0

2 years ago

2.14.1

3 years ago

2.14.2

3 years ago

2.14.0

3 years ago

2.13.0-1

3 years ago

2.13.0-2

3 years ago

2.13.0-3

3 years ago

2.13.0

3 years ago

2.12.2

3 years ago

2.11.11

3 years ago

2.12.0

3 years ago

2.12.1

3 years ago

2.12.0-5

3 years ago

2.12.0-6

3 years ago

2.11.10

3 years ago

2.12.0-4

3 years ago

2.12.0-3

3 years ago

2.12.0-2

3 years ago

2.11.8

3 years ago

2.11.9

3 years ago

2.12.0-1

3 years ago

2.11.7

3 years ago

2.13.0-0

3 years ago

2.12.0-0

3 years ago

2.11.6

3 years ago

2.11.5

3 years ago

2.11.4

3 years ago

2.11.3

3 years ago

2.11.2

3 years ago

2.11.1

3 years ago

2.11.0

3 years ago

2.11.1-0

3 years ago

2.10.1

3 years ago

2.10.0

3 years ago

2.9.10

3 years ago

2.9.9

3 years ago

2.9.9-0

3 years ago

2.9.9-1

3 years ago

2.9.9-2

3 years ago

2.9.8

3 years ago

2.9.7

3 years ago

2.9.6

3 years ago

2.9.6-0

3 years ago

2.9.5

3 years ago

2.9.5-5

3 years ago

2.9.5-4

3 years ago

2.9.5-3

3 years ago

2.9.5-0

3 years ago

2.9.5-1

3 years ago

2.9.5-2

3 years ago

2.9.4

3 years ago

2.9.4-0

3 years ago

2.9.4-1

3 years ago

2.9.4-2

3 years ago

2.9.4-3

3 years ago

2.9.4-4

3 years ago

2.9.3

3 years ago

2.9.3-0

3 years ago

2.9.2

3 years ago

2.9.1

3 years ago

2.9.0

3 years ago

2.8.1

3 years ago

2.8.2

3 years ago

2.8.0

3 years ago

2.6.0

3 years ago

2.7.0

3 years ago

2.5.4

3 years ago

2.6.0-3

3 years ago

2.6.0-1

3 years ago

2.6.0-2

3 years ago

2.5.3

3 years ago

2.6.0-0

3 years ago

2.5.0

3 years ago

2.5.2

3 years ago

2.5.1

3 years ago

2.5.0-0

3 years ago

2.4.0

3 years ago

2.0.0-0

3 years ago

2.1.0-1

3 years ago

2.1.0-2

3 years ago

2.1.0-4

3 years ago

1.8.1-1

3 years ago

2.3.0

3 years ago

2.3.1

3 years ago

2.2.0-0

3 years ago

1.9.0-10

3 years ago

2.2.0-1

3 years ago

2.3.0-1

3 years ago

2.3.0-0

3 years ago

2.3.0-3

3 years ago

2.3.0-2

3 years ago

1.8.0

3 years ago

1.6.0

3 years ago

1.9.0-5

3 years ago

1.9.0-6

3 years ago

1.9.0-3

3 years ago

1.9.0-4

3 years ago

1.9.0-1

3 years ago

1.9.0-2

3 years ago

1.9.0-0

3 years ago

1.9.0-9

3 years ago

1.9.0-7

3 years ago

1.9.0-8

3 years ago

1.8.1-0

3 years ago

1.7.1-1

3 years ago

1.7.1-0

3 years ago

1.6.0-5

3 years ago

1.6.0-4

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.8.0-4

3 years ago

1.8.0-5

3 years ago

1.8.0-6

3 years ago

1.8.0-7

3 years ago

1.8.0-0

3 years ago

1.8.0-1

3 years ago

1.8.0-2

3 years ago

1.6.0-3

3 years ago

1.6.0-1

3 years ago

1.5.0

3 years ago

1.5.0-3

3 years ago

1.5.0-2

3 years ago

1.5.0-1

3 years ago

1.5.0-0

3 years ago

1.6.0-0

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.0-0

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.0-2

3 years ago

1.3.0-1

3 years ago

1.3.0-0

3 years ago

1.2.2-1

3 years ago

1.2.2-0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago