Skip to main content
Version: v2

getScene

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Get the current scene where the Mini Program is running.

Type

function getScene(): Result

Parameters

Result

TypeDescription
numberThe current scene in which the Mini Program is running, value reference scene constants

Constants

Current scene running Mini Program constants

ConstantDescriptionAPI_LEVEL
SCENE_APPIn Mini Program2.0
SCENE_WATCHFACEIn watchface interface2.0
SCENE_SETTINGSIn the Mini Program configuration or dial edit page2.0
SCENE_AODIn the rest screen screen2.0

Example

import { getScene, SCENE_APP } from '@zos/app'

const result = getScene()

if (result === SCENE_APP) {
console.log('in Mini Program')
}