improve click block, onKeyboardClose

This commit is contained in:
Adam Bradley
2015-09-14 21:06:53 -05:00
parent ca6b562d72
commit 722dddbbb7
5 changed files with 56 additions and 32 deletions

View File

@@ -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);