offAppShow(callback: Function)

Requires:
Base Library≥2.10.0

Description

Stop listening for the Mini Program entering the foreground

Parameters

ParameterTypeRequiredDescription
YesCallback for canceling the Mini Program foreground switch event listener

Return Value

None

Examples

Stop listening for the mini program entering the foreground

Page({
  data: {
    handler: null,
  },
  onLoad() {
    this.data.handler = (res) => {
      console.log('Mini Program moved to foreground', res.path);
    };
    ty.onAppShow(this.data.handler);
  },
  onUnload() {
    ty.offAppShow(this.data.handler);
  },
});