Skip to content

Releases: cher-ami/utils

v1.4.1

17 Oct 08:33
Compare
Choose a tag to compare

fix randomRange #17

v1.4.0

11 Sep 15:54
Compare
Choose a tag to compare

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

v1.3.1

31 Aug 09:05
Compare
Choose a tag to compare
  • fix export filename

v1.3.0

30 Aug 16:36
Compare
Choose a tag to compare

Update repo struct (#11)

  • build with pnpm & tsup
  • split utils in separated files

v1.2.0

25 Apr 09:35
Compare
Choose a tag to compare

Add functions in math utils

  • normalizeValue to get normalized value between 2 numbers
  • originalValueFromNormalized to get original value from normalized value

#9 Make FacebookApi ID optionnal and fix facebook sharing app url

v1.0.1

07 Nov 11:00
Compare
Choose a tag to compare

#4 Fix use of isHandledDevice with ssr usage: Add condition for "navigator" global var.

v1.0.0

13 Oct 09:09
Compare
Choose a tag to compare

fix #3