Installation
Croner can be installed using your preferred package manager or CDN. After installation, it can be included in your project as follows:
If you are migrating from a different library such as
cron
ornode-cron
, or upgrading from an older version of croner, see the Migration Guide.
Importing with Node.js or Bun
For Node.js or Bun, you can use ESM Import or CommonJS Require:
// ESM Import
import { Cron } from "croner";
// or CommonJS Require, destructure to add type hints
const { Cron } = require("croner");
Importing with Deno
For Deno, import Croner from the provided URL:
// From deno.land/x
import { Cron } from "https://deno.land/x/croner@8.1.2/dist/croner.js";
// ... or jsr.io
import { Cron } from "jsr:@hexagon/croner@8.1.2";
Make sure to replace 8.1.2
with the latest version.
In a Webpage Using the UMD-module
To use Croner in a webpage, you can load it as a UMD module from a CDN:
<script src="https://cdn.jsdelivr.net/npm/croner@9/dist/croner.umd.js"></script>