Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Pomo

import { Pomo } from "https://raw.githubusercontent.com/EthanThatOneKid/pomo/main/pomo.ts";

A Pomo is a cycle of work and break periods.

class Pomo {
constructor(
cycle: Cycle,
dayLength: number,
ref: number,
);
public get eternal(): boolean;
 
public at(n: number): PomoStamp;
 
static public fromPattern(options: PatternOptions): Pomo;
}

§Constructors

§
new Pomo(cycle: Cycle, dayLength: number, ref: number)
[src]

§Properties

§
eternal: boolean readonly
[src]

Whether or not the pomo is eternal.

§Methods

§
at(n: number): PomoStamp
[src]

The stamp at the given number.

§Static Methods

§
fromPattern(options: PatternOptions): Pomo
[src]

Create a pomo from a pattern.

Example:

// Options for creating a pomo from a pattern
const pattern = "25w5b"; // 25 minutes of work, 5 minutes of break
const dayLength = DAY; // 1 day in milliseconds
const ref = new Date(new Date().setHours(0, 0, 0, 0)).valueOf(); // Previous midnight
const scale = MINUTE; // 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"));