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

@types/d3-timer

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-timer

TypeScript definitions for d3JS d3-timer module

  • 3.0.0
  • ts3.6
  • ts3.7
  • ts3.8
  • ts3.9
  • ts4.0
  • ts4.1
  • ts4.2
  • ts4.3
  • ts4.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.6M
decreased by-0.75%
Maintainers
1
Weekly downloads
 
Created

What is @types/d3-timer?

@types/d3-timer provides TypeScript type definitions for the d3-timer module, which is part of the D3.js library. The d3-timer module provides a simple timer mechanism for scheduling tasks to run at a specified time or interval, making it useful for animations, periodic updates, and other time-based operations.

What are @types/d3-timer's main functionalities?

Creating a Timer

This feature allows you to create a timer that calls a specified callback function repeatedly until the timer is stopped. The callback receives the elapsed time since the timer started.

import { timer } from 'd3-timer';

const t = timer((elapsed) => {
  console.log(`Elapsed time: ${elapsed}ms`);
  if (elapsed > 1000) t.stop();
});

Stopping a Timer

This feature allows you to stop a running timer either from within the callback function or from an external function.

import { timer } from 'd3-timer';

const t = timer((elapsed) => {
  console.log(`Elapsed time: ${elapsed}ms`);
  if (elapsed > 1000) t.stop();
});

// Stop the timer after 500ms
setTimeout(() => t.stop(), 500);

Creating an Interval

This feature allows you to create an interval that calls a specified callback function at a fixed time interval. The callback receives the elapsed time since the interval started.

import { interval } from 'd3-timer';

const i = interval((elapsed) => {
  console.log(`Elapsed time: ${elapsed}ms`);
  if (elapsed > 5000) i.stop();
}, 1000);

Creating a Timeout

This feature allows you to create a timeout that calls a specified callback function once after a specified delay. The callback receives the elapsed time since the timeout was scheduled.

import { timeout } from 'd3-timer';

timeout((elapsed) => {
  console.log(`Elapsed time: ${elapsed}ms`);
}, 2000);

Other packages similar to @types/d3-timer

FAQs

Package last updated on 26 Jun 2021

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