export function getEle ( selector ) { const ele = document . querySelectorAll ( selector ) ; if ( ele . length > 0 ) { const results = [ ] ; ele . forEach ( item => results . push ( item ) ) ; return results ; } throw new Error ( `cannot find ${ selector } element` ) ; } export function throttle ( fn , wait ) { let isCalled = false ; return function ( ... args ) { if ( ! isCalled ) { fn ( ... args ) ; isCalled = true ; setTimeout ( function ( ) { isCalled = false ; } , wait ) ; } } ; }