npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fitbit-core

v0.0.7

Published

A library to handle core functionality for building Fitbit OS watchfaces

Downloads

5

Readme

fitbit-core

Travis branch Coveralls branch npm badge

🌑 A library to handle core functionality for building Fitbit OS watchface

Note, this is still a work in progress

The purpose of this library is to provide a simple interface to abstract the basic core functionality of a Fitbit watchface (date and time). As a result, you'll be able to manage and render the time and date, all within 2 lines code, allowing you to focus mainly on styling and superset features.

Functionality

  • Manage and Display Date including i18n / multi-language support
  • Manage and Display Time including user's format preferences and updating on ticks.
  • Simple interface
  • Support custom font through FitFont Rendering

Future Roadmap

  • multi-line time (hour / minutes)
  • Support seconds

Usage

Create a Text or FitFont element in your .view. Provide that ID to the core class caller, and initialize the core.

const TimeConfiguration = { timeId: 'time' };
const DateConfiguration = { dateId: 'date' };

const core = new Core(TimeConfiguration, DateConfiguration);
core.initialize();

Example: Coloring Elements

const core = new Core({ timeId: 'time', dateId: 'date' });
core.initialize();

if (user.clicked) {
    core.time.setColor('deepbluesky');
    core.date.setColor('plum');
}

Example: Fitfont index.view: View GUI File

    <svg>
        <use href="#fitfont" id="time">
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
        </use>
        <use href="#fitfont" id="date">
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
            <use href="#fitfont-char"/>
        </use>
    </svg>

your.js: Clockface JS File

const CustomDateFont = {
    dateId: 'date',
    font: 'Roboto_30',
    halign: 'middle',
    valign: 'start',
    letterspacing: 0
};

const CustomTimeFont = {
    dateId: 'time',
    font: 'Roboto_70',
    halign: 'middle',
    valign: 'start',
    letterspacing: 1
};

const core = new Core(CustomTimeFont, CustomDateFont);
// Time and Date Displayed
core.initialize();

if (someCondition) {
    const TimeElement = core.time.get();
    TimeElement.letterspacing = 3;
    TimeElement.halign = 'end';
}

fitbit-core/app

Core(TimeConfiguration, DateConfiguration)

Type: class Usage: new Core(TimeConfiguration, DateConfiguration)

TimeConfiguration

Type: object Configuration for the element used to display the time.

timeId (required)

Type: string ID of the Time Element

fitfont

Type: object Fitfont configuration, this will render the element as a Fitfont element instead. ID will be populated with the timeId.

format

Type: enum ("12h"/"24h") Configure which format will the clock display.

onTick

Type: function Register a callback that will be executed upon tick (clock update) events.

DateConfiguration

Type: object Configuration for the element used to display the date.

dateId (required)

Type: string ID of the Date Element

fitfont

Type: object Fitfont configuration, this will render the element as a Fitfont element instead. ID will be populated with the dateId.

i18n

Type: boolean Set to true to automatically reference your PO files for translations. Days are all lowercase.

Note: fitbit-core will use these msgid to map across your i18n/po files: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']

Core Instance API

core.date

Type: Class Instance

core.date.set(dateObject)

Parses the date object and sets the element text value to the date.

core.date.setColor(colorString)

Sets the Date element color to the value inputted.

core.time

Type: Class Instance

core.time.set(dateObject)

Parses the date object and sets element text value to the time.

core.time.setColor(colorString)

Sets the Time element color to the value inputted.

core.time.onTick(onTickHandler)

Configure a onTick handler to be called when the time ticks

Relevant

This library works well in conjunction with:

License

MIT © Brandon Him