Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zmp-sdk

Package Overview
Dependencies
Maintainers
1
Versions
349
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zmp-sdk

Zalo Mini App SDK

  • 1.5.0
  • npm
  • Socket score

Version published
Weekly downloads
658
decreased by-9.24%
Maintainers
1
Weekly downloads
 
Created
Source

ZaloMiniAppSDK

Zalo Mini apps SDK. Contains all methods separated by categories

Table of contents

Authentication Methods

  • getAccessToken
  • login

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>

FAQs

Package last updated on 22 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc