New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

overtime

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

overtime

Overtime is a stopwatch library that visualises time limits in 2D.

  • 0.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Overtime

Build status Windows build status GitHub version npm version Dependencies

Overtime is a stopwatch library that visualises time limits in 2D by using the Canvas API.

Installation

Download the minified library and include it in your project:

<script src="/js/overtime.min.js"></script>

You can also install it with npm.

$ npm install overtime

Usage

import Overtime from "overtime";

// Create an Overtime instance.
var overtime = new Overtime({
	time: 5,
	timeMeasure: Overtime.TimeMeasure.MINUTES,
	size: [300, 300]
});

/*
 * In order to append the canvas of Overtime to your 
 * website, you'll have to listen for the document's
 * "DOMContentLoaded"-event.
 *
 * If you want to rely on the sizes of DOM elements 
 * such as the body of your page, you should use the
 * "load"-event of the window object instead.
 */

document.addEventListener("DOMContentLoaded", function init() {

	// Grab the output canvas and put it on the page.
	document.getElementById("myContainer").appendChild(overtime.canvas);

	// Do something when the time elapsed.
	overtime.addEventListener("elapsed", function() {

		console.log("Time's up!");

	});

	// Control Overtime.
	overtime.stop();
	overtime.start();
	overtime.rewind();
	overtime.rewindBy(Number.MAX_VALUE);
	overtime.fastForwardBy(2);
	overtime.prolongBy(2);
	overtime.timeMeasure = Overtime.TimeMeasure.MILISECONDS;
	overtime.shortenBy(100);
	overtime.timeMeasure = Overtime.TimeMeasure.HOURS;
	overtime.time = 1;

	// Clean up.
	document.removeEventListener("DOMContentLoaded", init);

});

Example

Take a look at the demo to see how Overtime works.

Documentation

API

Contributing

Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

Copyright (c) 2015 Raoul van Rüschen
Licensed under the Zlib license.

Keywords

FAQs

Package last updated on 06 Nov 2015

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