Skip to content

v1.4.0

Choose a tag to compare

@willybrauner willybrauner released this 11 Sep 15:54
· 4 commits to main since this release

features

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