pomo 🍅

deno doc

Pomodoro utility module.

Installation and Usage

Deno

import { format, Pomo } from "https://deno.land/x/pomo/mod.ts";

Node.js

Install the module as an NPM package:

npm i https://github.com/ethanthatonekid/pomo.git#npm

Then, import it in your project:

import { format, Pomo } from "pomo";

Example usage

// Options for creating a pomo from a pattern
const pattern = "25w5b"; // 25 minutes of work, 5 minutes of break
const dayLength = 1 * 24 * 60 * 60 * 1e3; // 1 day in milliseconds
const ref = new Date(new Date().setHours(0, 0, 0, 0)).valueOf(); // Previous midnight
const scale = 1 * 60 * 1e3; // Scale minutes in pattern to milliseconds

const pomo = Pomo.fromPattern({
  pattern, // required
  dayLength, // required
  ref, // required
  scale, // default = 1
});

const stamp = pomo.at(new Date().valueOf());
console.log(format(stamp.timeout, "HH:mm:ss.SSS"));

API

For generated API documentation, see https://deno.land/x/pomo.

License

MIT


Made with 💖 by @EthanThatOneKid