Function
makeButton
(className, fn, shouldDisable = true)
Source from the content-addressed store, hash-verified
| 45 | }; |
| 46 | |
| 47 | const makeButton = (className, fn, shouldDisable = true) => { |
| 48 | const button = document.querySelector(className); |
| 49 | button.addEventListener("click", () => { |
| 50 | if (shouldDisable) { |
| 51 | button.disabled = true; |
| 52 | } |
| 53 | fn() |
| 54 | .then(() => { |
| 55 | button.disabled = false; |
| 56 | }) |
| 57 | .catch(handleError); |
| 58 | }); |
| 59 | }; |
| 60 | |
| 61 | makeButton(".lazy-button", () => import("./lazy")); |
| 62 | makeButton(".lazy-button2", () => import("./lazy2.css")); |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…