2.0.1 • Published 6 months ago

@uplift-ltd/use-safe-timeout v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@uplift-ltd/use-safe-timeout

Installation

npm i --save @uplift-ltd/use-safe-timeout

API

useSafeTimeout

Returns a function to cancel the timeout

import { useSafeTimeout } from "@uplift-ltd/use-safe-timeout";

function MyComponent() {
  const setSafeTimeout = useSafeTimeout();
  const cancelTimeout = setSafeTimeout(
    () => console.log("I get called in 5s if component stays mounted!"),
    5000
  );
  return <button onClick={cancelTimeout}>Cancel Timeout</button>;
}
2.0.1-alpha.0

6 months ago

2.0.1-alpha.1

6 months ago

2.0.1

6 months ago

2.0.0

6 months ago

2.0.0-alpha.0

1 year ago

2.0.0-alpha.1

1 year ago

2.0.0-alpha.2

1 year ago

1.2.4-alpha.0

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.3-alpha.1

1 year ago