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

warped-time

v0.0.19

Published

Provides an equivalent to Date.getTime() with variable progression speed.

Downloads

196

Readme

warped-time: Control the progression of time npm version Github Stars Twitter URL

▶️ API | Info | redux-time | Example | Source

Simple Javascript library that provides an equivalent to Date.getTime() with variable progression speed.

It has a hook to receive timestamps and estimated latency, which it uses to stay in sync with a backend server's time.

LIVE DEMO

yarn add warped-time    # ⏱

For more details and usage examples see docs on redux-time.

API

window.time = new WarpedTime(window.store, 1)
// takes: optional redux store, initial_speed, initial_timestamp

window.time.getActualTime()
> 1499014500
window.time.getWarpedTime()
> 1499014500

window.time.setSpeed(-1)   // make time start going backwards at -1x

window.time.getActualTime()
> 1499014501
window.time.getWarpedTime()
> 1499014499

window.time.setSpeed(0.01)  // make time progress at 0.01x its actual speed

window.time.getWarpedTime()
> 1499014499.01

const server_time = timestamp_from_server + rtlatency/2
window.time.setWarpedTime(server_time) // set time to the server time instantly

window.time.setWarpedTime(server_time, 1000) // sync to server time over 1000ms

Info

This library is useful for:

  • time-travel debugging
  • animations
  • any situation where you want a version of time that's flowing slower/faster/reversed compared to the actual time
  • keeping a front-end time in sync with a backend time
  • real-time games

We use it for time-travel debugging and animation timing sync in our library redux-time.


MIT License | Monadical SAS 2017 (we're hiring!)