Become a member
Sign in
Lars Jacobsson
Lars Jacobsson

Lars Jacobsson

2 Following
2 Followers
  • Profile
  • Claps
  • Highlights
  • Responses

Highlighted by Lars Jacobsson

See more

From Throttling and Debouncing in JavaScript by Jhey Tompkins

const throttle = (func, limit) => {
let lastFunc
let lastRan
return function() {
const context = this
const args = arguments
if (!lastRan) {
func.apply(context, args)
lastRan = Date.now()
} else {
clearTimeout(lastFunc)
lastFunc = setTimeout(function() {
if ((Date.now() - lastRan) >= limit) {
func.apply(context, args)
lastRan = Date.now()
}
}, limit - (Date.now() - lastRan))
}
}
}

Claps from Lars Jacobsson

See more

Interesting! Why did you end up switching off Elm? What was your reasoning?

Gage Peterson

So You Want to be a Functional Programmer (Part 3)

Charles Scalfani