The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Use lodash throttle With ES Modules In Vanilla JavaScript

TODO: Pull subtitle into page object
0

Notes

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Use lodash throttle With ES Modules In Vanilla JavaScript

This is how I'm using lodash's throttle via ES modules
in vanilla JS. 

-- todo 

[] These are the things to document

[] install lodash cli

[] build modularized files

[] Split out separate page with just
the function and not event data being
passed thru

[] show this bind for a module based of stem-mixer

[] this.throttled = throttle(this.handleFaderMove.bind(this) , 1042)


-- html
-- show

<div id="theCount">0</div>

<button id="testButton">Counter</button>


-- script
-- type: module
-- show

import throttle from "/scripts/lodash/throttle.js"

let count = 0

const increment = (event) => {
  count += 1
  theCount.innerHTML = count
  console.log(event.target)
}

const throttled = throttle((event) => {increment(event)}, 1000)

document.addEventListener("DOMContentLoaded", () => {
  testButton.addEventListener("click", throttled)
})


-- notes

- You can pass event stuff through as shown
in the example. That's not required


-- categories
-- JavaScript 

-- metadata
-- date: 2023-08-27 19:16:16
-- id: 2uawt6fh
-- site: aws
-- type: post
-- status: draft