npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

suncronjob

v2.0.1

Published

A type of cron library that can work by time or in relation to sunrise / sunset

Downloads

4

Readme

suncronjob

This is a version of cron that is based around sunrise and sunset rather than a fixed time of day.

Instalation

npm install suncronjob

Note

From version 2.0.0 onwards, this no longer calls an external library for the cron function. Also this version uses a different syntax from version 1.

Example

SunCronJob = require('suncronjob');

options = {
  latitude: 59.436962,      // Tallinn, Estonia
  longitude: 24.753574,
  hours: 1,             // One hour,
  minutes: 10,          // ten minutes
  seconds: 30,          // and 30 seconds
  offset: 'after',      // after
  riseset: 'sunrise',   // sunrise
  once: false           // every day.
};

const task = function() {
  console.log("Hello, World!");

const job = new SunCronJob(options, task);

Usage

Constructor

SunCronJob = require('suncronjob');

const job = new SunCronJob(options, task);

Options

latitude (Default: London, Greenwich)

longitude (Default: London, Greenwich)

These must be set in order for the sunrise and sunset times to be calculated correctly. They are expressed as positive decimals for North and East, negative for South and West.

hours (Default: zero)

minutes (Default: zero)

seconds (Default: zero)

This is the time before or after sunrise or sunset that the job should run.

offset (Default: before)

This must be set to "before" or "after" (or left unset).

riseset (Default: sunrise)

This must be set to "sunrise" or "sunset" (or left unset).

once (Default: false)

If set to true, this job will only run once.

Task

This is the function to run each day at the time before or after sunset as specified.

Function

job.cancel()

This cancels the timer and thus stops the job. There is no way to restart it, other than calling new() again.

Acknowlegements

Many thanks to Kelektiv for his excellent cron package.

However, version 2.0.0 of this package no longer uses the cron package.

Author

Cliff Stanford <[email protected]>

Issues

Please report all issues via the Github issues page.

Licence

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author of this software dedicates any and all copyright interest in the software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org