[英]hardware back button is called twice ionic5
I try to configure hardware back button and call a function inside it:我尝试配置硬件后退按钮并在其中调用一个函数:
import { Platform } from '@ionic/angular';
constructor(private platform: Platform) {
this.platform.backButton.subscribeWithPriority(10, () => {
//call my function here
});
}
but when i click on the button it's called twice.I'm working with ionic5.但是当我点击按钮时,它会被调用两次。我正在使用 ionic5。 any ideas?
有任何想法吗?
You can try async and await as follow
import { Platform } from '@ionic/angular';
constructor(private platform: Platform) {
this.platform.backButton.subscribeWithPriority(10, async () => {
await this.functionCall() // Your function call goes here
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.