|
- const utils = {
- isElement:function(el){
-
-
- try {
-
- return el instanceof HTMLElement;
- } catch(e) {
-
-
-
- return (typeof(el) === "object") &&
- (el.nodeType === 1) &&
- (typeof(el.style) === "object") &&
- (typeof(el.ownerDocument) === "object");
- }
- },
-
- debounce:function(func, delay){
- var timeout = null;
- return function(){
- var context = this;
- var args = arguments;
- clearTimeout(timeout);
- timeout = setTimeout(function(){
- func.apply(context, args);
- }, delay);
- };
- }
- };
-
-
- Object.freeze(utils);
- export default utils;
|