Skip to content

Instantly share code, notes, and snippets.

@painedpineapple
Last active March 3, 2020 16:36
Show Gist options
  • Save painedpineapple/def6c9709b6b306f9d8b9c217f765b85 to your computer and use it in GitHub Desktop.
Save painedpineapple/def6c9709b6b306f9d8b9c217f765b85 to your computer and use it in GitHub Desktop.
type timerValue = {
seconds: int,
minutes: int,
hours: int,
days: int,
start: unit => unit,
pause: unit => unit,
restart: unit => unit,
};
type timerProps = {
expiryTimestamp: float, // timestamp
onExpire: unit => unit,
};
[@bs.module "react-timer-hook"]
external useTimer: timerProps => timerValue = "useTimer";
type stopWatchValue = {
seconds: int,
minutes: int,
hours: int,
days: int,
start: unit => unit,
pause: unit => unit,
reset: unit => unit,
};
type stopWatchProps = {autoStart: bool};
[@bs.module "react-timer-hook"]
external useStopWatch: stopWatchProps => stopWatchValue = "useStopWatch";
type timeValue = {
seconds: int,
minutes: int,
hours: int,
ampm: string,
};
type timeProps = {format: string};
[@bs.module "react-timer-hook"]
external useTime: timeProps => timeValue = "useTime";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment