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

ember-cli-clock

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-clock

A very simple observable clock service for EmberJS.

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
120
decreased by-9.09%
Maintainers
1
Weekly downloads
 
Created
Source

Clock

A very simple observable clock service for EmberJS.

I display time in many of my projects and need to keep the displayed time up-to-date so I generalized the solution to this Ember CLI Add-on.

Live Demo

Build Status

Installation

npm install --save-dev ember-cli-clock

Usage

The clock service is injected into all controllers. This means you can observe changes like so for use with MomentJS:

App.MessageController = Ember.Controller.extend({
  posted: function() {
    return moment(this.get('timestamp')).fromNow();
  }.property('clock.minute')
});

{{posted}} outputs "2 minutes ago" and updates

Or a clock that uses the local system time and updates every second.

App.ApplicationController = Ember.Controller.extend({
  time: function() {
    return moment().format('h:m:s');
  }.property('clock.second')
});

API

You can observe or display the following properties:

  • second
  • minute
  • five
  • quarter
  • hour

Each one is an incrementing integer.

During testing you may also set a custom interval time to speed up your tests. For example use this.clock.set('intervalTime', 100); to run the clock 10 times faster.

You may also reset the clock to 0 using this.clock.reset();

Authors

Copyright (c) 2014 Jerel Unruh and contributors

Licensed under the MIT license

Keywords

FAQs

Package last updated on 21 Dec 2014

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