Skip to content

mebble/medley

Repository files navigation

medley

CI Status NPM

Table of Contents

Usage

import { MedleyConfig, startTimer } from "@mebble/medley";

const config: MedleyConfig = {
    name: 'Shoulder stretches',
    timer: {
        type: 'sequence',
        of: [{
            type: 'loop',
            times: 2,
            of: {
                type: 'sequence',
                of: [
                    { type: 'unit', name: 'Left shoulder', duration: 30 },
                    { type: 'unit', name: 'Rest', duration: 10 },
                    { type: 'unit', name: 'Right shoulder', duration: 30 },
                    { type: 'unit', name: 'Rest', duration: 10 },
                ]
            }
        }, {
            type: 'unit',
            name: 'Rest',
            duration: 30
        }]
    }
};

startTimer(config, event => {
    console.log(event)
});

Installation

Using a package manager

Install with any one of the following package managers:

npm install @mebble/medley
yarn add @mebble/medley
pnpm add @mebble/medley

Using a CDN

If your JS code is placed within a <script type="module">, you can import as an ES module from a CDN:

<script type="module">
    import medley from 'https://esm.sh/@mebble/medley';
</script>

Alternatively, you can import the bundle:

<script src="https://cdn.jsdelivr.net/npm/@mebble/medley@latest/dist/index.umd.js"></script>

Here, the library will be available as the global variable medley.

API Reference

The API reference is available on the website.

Contributing

See the contribution guide at CONTRIBUTING.md.