👋 Hey there, I'm Alexandro castro, brazilian 🇧🇷 , but now living in Portugal 🇵🇹
I Love Open Source, FrontEnd and Mobile Development Project
👨💻 All of my projects are available at https://github.com/alexcastrodev
📝 I regularly write articles on https://alexandrocastro.dev.br
📄 Know about my experiences https://www.linkedin.com/in/alexandro-c-oliveira/
If you want to use npm
, you can use this command.
npm i castroclock
Maybe you want to use yarn
.
yarn add castroclock
This package
does not have any dependencies. Therefore, you are free to design what you want.
Import this module
import CastroClock from 'castroclock-js'
To have a typescript support, you should import
import { CastroClockType } from 'castroclock/types'
Project code:
https://github.com/AlexcastroDev/chronometer-react
Preview: https://chronometer.vercel.app/
All calls and exceptions are covered by Jest
This method returns instance of Timer, and start chronometer
Exemple:
CastroClock.start()
This method returns instance of Timer, and pause chronometer
CastroClock.pause()
This method is a void, and resume chronometer
CastroClock.continue()
This method returns an array of stops (object), that contains: start_at (unix)
, ends_at (unix)
and a string called period
that returns 00:00:04
If start
and wait
4 seconds
CastroClock.lap()
This method returns instance of Timer, and reset chronometer status
const logger = () => {
console.log("I'm here")
}
CastroClock.onChange(logger)
This method recieve a () => void
that is called when [one of them] pause
, reset
, lap
, continue
are called.
CastroClock.reset()
This getter returns an object, that contains: hours (Number)
, minutes (Number)
, seconds (Number)
This getter returns a string that returns 00:00:04
If start
and wait
4 seconds
Period time: When you call CastroClock.start()
untill Call this getter.
This getter returns an object, that contains: hours (Number)
, minutes (Number)
, seconds (Number)
This getter returns a string that returns 00:30:00
If you start
, wait about 30 minutes and call this getter or your lap
s time is about 30 minutes and call this getter.
This getter returns a Proxy Handler
_instance: {
startInstance: Number | null,
stopInstance: Number | null,
},
stopwatch: {
startTime: Number | null,
stopTime: Number | null,
},
stops: [
{
start_at: Number | null,
ends_at: Number | null,
period: string | null,
}
],
onChange: Function