mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
improve click block, onKeyboardClose
This commit is contained in:
@@ -145,7 +145,35 @@ export class IonicPlatform {
|
||||
return !this.isPortrait();
|
||||
}
|
||||
|
||||
winResize() {
|
||||
isKeyboardOpen() {
|
||||
return dom.hasFocusedTextInput();
|
||||
}
|
||||
|
||||
onKeyboardClose(callback) {
|
||||
const self = this;
|
||||
|
||||
let promise = null;
|
||||
|
||||
if (!callback) {
|
||||
// a callback wasn't provided, so let's return a promise instead
|
||||
promise = new Promise(resolve => { callback = resolve; });
|
||||
}
|
||||
|
||||
function checkKeyboard() {
|
||||
if (!self.isKeyboardOpen()) {
|
||||
callback();
|
||||
|
||||
} else {
|
||||
setTimeout(checkKeyboard, 500);
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(checkKeyboard, 100);
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
windowResize() {
|
||||
let self = this;
|
||||
clearTimeout(self._resizeTimer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user