offAppShow

Requires:
Base Library≥2.10.0

Method signature
offAppShow(callback: )

Description

Stop listening for the Mini Program entering the foreground

Parameters

ParameterTypeRequiredDescription
(res: ) => voidYesCallback 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);
  },
});