my.onAppHide

Updated at:

Listens for the event triggered when the miniapp switches to the background.

Introduction

my.onAppHide

Listens for the event triggered when the miniapp switches to the background.

Dynamically registers the onHide() lifecycle callback. To unregister the listener, call my.offAppHide.

Parameters

Function listener

Callback function invoked when the miniapp switches to the background.

Code example

my.onAppHide(Function listener)

const onAppHideHandler = () => {
 console.log('onAppHide handler called')
};

my.onAppHide(onAppHideHandler);