let there be typescript

This commit is contained in:
Adam Bradley
2015-07-03 13:19:30 -05:00
parent 9242e34a71
commit 1ae3113386
184 changed files with 1865 additions and 1068 deletions

34
ionic/util/click-block.ts Normal file
View File

@ -0,0 +1,34 @@
const CSS_CLICK_BLOCK = 'click-block-active';
const DEFAULT_EXPIRE = 330;
let cbEle, fallbackTimerId;
let isShowing = false;
function show(expire) {
clearTimeout(fallbackTimerId);
fallbackTimerId = setTimeout(hide, expire || DEFAULT_EXPIRE);
if (!isShowing) {
isShowing = true;
if (cbEle) {
cbEle.classList.add(CSS_CLICK_BLOCK);
} else {
cbEle = document.createElement('div');
cbEle.className = 'click-block ' + CSS_CLICK_BLOCK;
document.body.appendChild(cbEle);
}
}
}
function hide() {
clearTimeout(fallbackTimerId);
if (isShowing) {
cbEle.classList.remove(CSS_CLICK_BLOCK);
isShowing = false;
}
}
export let ClickBlock = function(shouldShow, expire) {
(shouldShow ? show : hide)(expire);
};