
import $ from "jquery";
const $window = $(window);
const $doc = $(document);

const $$ = {
    $window: $window,
    $doc: $doc,
    getHeight: function (node) {
        return $(node).innerHeight();
    },
    getWidth: function (node) {
        return $(node).innerWidth();
    },
    animate: {
        left: function (el, left) {
            
        },
        top: function (el, top) {
            
        },
        slideDown: function ($el, cb) {
            let h = $el.height();
            let cacheH = 0;
            let timer = setInterval(function () {
                $el.height(cacheH);
                cacheH++;
                if(cacheH >= h) {
                    clearInterval(timer);
                    cb && cb();
                }
            }, 20);
           
        },
        slideUp: function ($el, cb) {
            let h = $el.height();
            
            let cacheH = 0;
            let timer = setInterval(function () {
                $el.height(cacheH);
                cacheH--;
                if(cacheH <= 0) {
                    clearInterval(timer);
                    $el.height(h);
                    cb && cb();
                }
            }, 20);
            
        }

    }
}


module.exports = $$;