getLaunchOptions(params: Object)

Requires:
MiniKit≥1.0.0@ray-js/ray≥0.3.23
Platforms:
iOSAndroid
import { getLaunchOptions } from '@ray-js/ray';

// Promise usage
try {
  const res = await getLaunchOptions();
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Get the parameters at mini program startup. Same as the callback parameters of App.onLaunch.

Parameters

PropertyTypeRequiredDescription
complete() => voidNoCompletion callback (executed on both success and failure)
success(params: Object) => voidNoCallback on successful API call
fail(params: Object) => voidNoFailure callback
success callback parameters
PropertyTypeDescriptionMiniKit Since
pathstringPath used to launch the mini program (package path)v3.2.0
scene1000 | 1001 | 1002Scene value for launching the mini programv3.15.0
Query parameters used to launch the mini programv3.2.0
Sharev3.2.0
apiCategorystringAPI category: default: default category; embedded: embedded, a mini program opened via the half-screen mini program capabilityv3.2.0
Additional parameters for launching the mini program, typically container-attached parameters rather than business parametersv3.21.0
rendererstringRendering type: native indicates Lynx self-rendering; empty/other indicates Webv3.37.0
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Valid Values

success.params.scene
ValueDescriptionMiniKit Since
1000Default valuev3.15.0
1001Launched via the Recently Used Mini Programs listv3.15.0
1002Launched via URL mappingv3.15.0

Examples

import { getLaunchOptions } from '@ray-js/ray'

getLaunchOptions({
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});