Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
spAnser authored Mar 24, 2017
1 parent 2494e81 commit 3f24670
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions root/src/assets/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ let hasClass = (className, el) => {
}

let throttle = (delay, callback) => {
var previousCall = new Date().getTime()
return function() {
var time = new Date().getTime()
if ((time - previousCall) >= delay) {
previousCall = time
callback.apply(null, arguments)
}
var previousCall = new Date().getTime()
return function() {
var time = new Date().getTime()
if ((time - previousCall) >= delay) {
previousCall = time
callback.apply(null, arguments)
}
}
}

let debounce = (delay, callback) => {
var timeout = null
return function() {
if (timeout) {
clearTimeout(timeout);
}
var args = arguments
timeout = setTimeout(() => {
callback.apply(null, args)
timeout = null
}, delay)
var timeout = null
return function() {
if (timeout) {
clearTimeout(timeout);
}
var args = arguments
timeout = setTimeout(() => {
callback.apply(null, args)
timeout = null
}, delay)
}
}

let ready = fn => {
Expand Down

0 comments on commit 3f24670

Please sign in to comment.