https://github.com/instafluff/comfyclock
The Comfiest Clock Events Set To World-Time! e.g. ComfyTimer.Every[ "5 minutes" ] = ( date ) => console.log( date );
https://github.com/instafluff/comfyclock
Last synced: 5 months ago
JSON representation
The Comfiest Clock Events Set To World-Time! e.g. ComfyTimer.Every[ "5 minutes" ] = ( date ) => console.log( date );
- Host: GitHub
- URL: https://github.com/instafluff/comfyclock
- Owner: instafluff
- License: mit
- Created: 2019-09-26T04:02:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T12:38:41.000Z (almost 4 years ago)
- Last Synced: 2024-05-02T04:55:10.861Z (about 2 years ago)
- Language: JavaScript
- Size: 173 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ComfyClock
The Comfiest Clock Events Set To World-Time! Works in both Node and Browser!
**ComfyClock** gives you an event set to the world clock for when you need code run at specific seconds, minutes, hours, or even days.
```javascript
ComfyTimer.Every[ "5 minutes" ] = ( date ) => console.log( date );
```
## Instafluff ##
> *Like these projects? The best way to support my open-source projects is by becoming a Comfy Sponsor on GitHub!*
> https://github.com/sponsors/instafluff
> *Come and hang out with us at the Comfiest Corner on Twitch!*
> https://twitch.tv/instafluff
## Instructions ##
#### Node
1. Install `comfyclock`
```
npm install comfyclock --save
```
2. Add clock events using ComfyClock
```javascript
var ComfyClock = require("comfyclock");
ComfyClock.Every[ "5s" ] = ( date ) => console.log( "Tick", date );
ComfyClock.Every[ "10s" ] = ( date ) => console.log( "Tock!", date );
// This will output: "Tick" at every 5th second (0, 5, 10, 15, ..., 55) and "Tock" at every 10th (0, 10, 20, ..., 50)
```
#### Browser
1. Add `comfyclock.js`
```
```
2. Add clock events using ComfyClock
```html
ComfyClock.Every[ "5s" ] = ( date ) => console.log( "Tick", date );
ComfyClock.Every[ "10s" ] = ( date ) => console.log( "Tock!", date );
// This will output: "Tick" at every 5th second (0, 5, 10, 15, ..., 55) and "Tock" at every 10th (0, 10, 20, ..., 50)
```
## Example ##
```javascript
ComfyClock.Every[ "5 seconds" ] = ( date ) => console.log( "5th second!", date );
ComfyClock.Every[ "15s" ] = ( date ) => console.log( "15th second!", date );
ComfyClock.Every[ "1 minute" ] = ( date ) => console.log( "New minute!", date );
```