Page({ onShow() { my.onUnhandledRejection(this.handleRejection); }, onHide() { // Clean up when page is hidden my.offUnhandledRejection(this.handleRejection); }, handleRejection(res) { console.error('Rejection on page:', res.reason); }});
Pass the same callback function reference to my.offUnhandledRejection() that was used with my.onUnhandledRejection() to remove only that specific listener.