Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-stopwatch

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-stopwatch

Stopwatches, timers, clocks, oh my!

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
40
decreased by-62.96%
Maintainers
1
Weekly downloads
 
Created
Source

ember-stopwatch

This addon provides some utilities and services that make it easier to control timing in your Ember applications.

Installation

ember install ember-stopwatch

Demo

Demo

Usage

Stopwatch

As a utility

This is the primary use-case, and allows you to create multiple stopwatches anywhere in your application.

import Stopwatch from "ember-stopwatch/utils/stopwatch";

// ...
let stopwatch = new Stopwatch();
stopwatch.start();
stopwatch.stop();
stopwatch.reset();
stopwatch.on("tick", someHandler);
// ...
    {{this.stopwatch.elapsedMillis}}
    {{this.stopwatch.numTicks}}
As a Service

A stopwatch service can be used that is shared globally in your application.

export default class extends Component {
    @service stopwatch;
    @action
    start() {
        this.stopwatch.start();
    }
    @action
    stop() {
        this.stopwatch.stop();
    }
}

Timer

As a utility

This is the primary use-case, and allows you to create multiple stopwatches anywhere in your application.

import Timer from "ember-stopwatch/utils/stopwatch";

// ...
let timer = new Timer(60000);
timer.on("expired", someExpirationHandler);
timer.start();
// ...
    {{this.timer.remainingMillis}}
    {{this.timer.isExpired}}

Compatibility

  • Ember.js v3.12 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 01 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc