Releases: cher-ami/utils
Releases · cher-ami/utils
v1.4.1
v1.4.0
features
- #15 add
cls
Returns a string with all the classes passed as arguments
Useful to compose classes in jsx. (no need array param anymore)
cls("a", "b") // "a b"
cls(false && "a", "b") // "b"
- #13 add
deferredPromise
&waitPromise
deferredPromise
const deferred = deferredPromise();
deferred.promise.then(() => {
// deferredPromise is resolved!
});
waitPromise
await waitPromise(100)
- #14 add listener
Listen and unlisten with the return function (usefull for useEffect)
const unlisten = listen(window, "resize", () => {})
unlisten()
Liste unlisten multiple events on the same element
const unlisten = listen(window, ["resize", "scroll"], () => {})
unlisten()
Listen once and unlisten automaticaly
listenOnce(window, "resize", () => {})
Group listeners and unlisten all together
const unlisten = listenCompose(
listen(el, "click", mock),
listen(el2, "click", mock2),
);
unlisten()
- #11 Update repo struct
v1.3.1
- fix export filename