Skip to main content
The Deno 2 Release Candidate is here
Learn more

⚙ Motor

This is a starter template for building Deno packages in TypeScript, with GitHub Actions-powered CI, tests, CLI, and Semantic Release on GitHub and npm.

Deno CI GitHub Contributors TypeScript semantic-release

Start the motor

import { motor } from "https://deno.land/x/motor@0.0/mod.ts";

type Gears = Keys<"stopped" | "paused" | "playing" | "loading">;

type Events = Keys<"SELECT" | "LOAD" | "PLAY" | "PAUSE" | "STOP">;

const musicPlayer: MotorSpec<Gears, Events> = {
  gear: "stopped",
  transmission: {
    stopped: {
      on: { LOAD: "loading" },
    },
    paused: {
      on: { PLAY: "playing", STOP: "stopped" },
    },
    loading: {
      on: { PLAY: "playing", STOP: "stopped" },
    },
    playing: {
      on: { PAUSE: "paused", STOP: "stopped" },
    },
  },
};

Development

Run tests:

deno test --allow-read

📄 License

MIT