dlt.backExitInterceptor
Introduction
The exit interceptor capability allows you to intercept the exit event when the user attempts to exit the mini-program by clicking the back button.
Note: The interceptor takes effect after being in the mini-program for more than 10 seconds. It can be triggered up to 5 times a day, with each trigger requiring an interval of at least 60 seconds.
Parameters
Object object
Property | Type | Default | Required | Description |
---|---|---|---|---|
success | function | No | Callback function that is called when the exit event is intercepted successfully. | |
fail | function | No | Callback function that is called when the interface call fails. | |
complete | function | No | Callback function that is called when the interface call is complete, whether it succeeds or fails. |
Sample Code
Page({
onLoad() {
dlt.backExitInterceptor({
success: function (res) {
// Intercepted the exit or back event
},
fail: function (res) {
// Failed to intercept
},
complete: function (res) {},
});
},
});