touch improvements

This commit is contained in:
Devaev Maxim
2018-09-08 01:16:37 +03:00
parent 3a68c2ae10
commit 15981e62b5
9 changed files with 65 additions and 64 deletions

View File

@@ -10,6 +10,25 @@ var tools = new function() {
return http;
};
this.setOnClick = function(el, callback) {
el.onclick = el.ontouchend = function(event) {
event.preventDefault();
callback();
};
};
this.setOnDown = function(el, callback) {
el.onmousedown = el.ontouchstart = function(event) {
event.preventDefault();
callback();
};
};
this.setOnUp = function(el, callback) {
el.onmouseup = el.ontouchend = function(event) {
event.preventDefault();
callback();
};
};
this.debug = function(...args) {
if (__debug) {
console.log("LOG/DEBUG", ...args); // eslint-disable-line no-console