![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@prodo-ai/js-timing
Advanced tools
Utility library for handling time and timing.
Most of the functions in this library rely on a single main type, Duration
. To create a duration, use the duration
method:
import {duration, HOUR, SECONDS} from "@prodo-ai/js-timing";
const tenSeconds = duration(10, SECONDS);
const oneHour = duration(1, HOUR);
You can then modify durations, or convert them to different units:
const threeHours = oneHour.times(3);
const waitInMinutes = (numMinutes: number) => {/*...*/};
waitInMinutes(oneHour.in(MINUTES));
Returns a Promise
that will return after a provided duration;
import {waitFor} from "@prodo-ai/js-timing";
waitFor(duration(10, SECONDS)).then(() => console.log("Done."));
Runs a callback again and again. The optional second parameter specifies how much delay should be included between each execution:
import {repeatedly} from "@prodo-ai/js-timing";
const callback = () => {
console.log("foo")
};
const cancel = repeatedly(callback);
waitFor(duration(10, SECONDS)).then(cancel);
const cancel2 = repeatedly(callback, duration(1, SECOND));
waitFor(duration(10, SECONDS)).then(cancel2);
You can control the duration between each execution by returning a Duration
from your callback - the execution of the next callback will only happen after that duration has passed:
const callback = () => {
console.log("foo");
return duration(1, SECOND);
};
const cancel = repeatedly(callback);
waitFor(duration(10, SECONDS)).then(cancel); // The callback will executed
You can also specify an error handler:
const callback = () => {
throw new Error("Failed.");
};
const errorHandler = (error) => {
console.error(error.message);
};
const cancel = repeatedly(callback, duration(1, MILLISECOND), errorHandler);
Actually, this is just the same as repeatedly.
Owner: Prodo Tech Ltd
Maintainer: tdawes
License: UNLICENSED (for now)
FAQs
JS utilities for timing
The npm package @prodo-ai/js-timing receives a total of 7 weekly downloads. As such, @prodo-ai/js-timing popularity was classified as not popular.
We found that @prodo-ai/js-timing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.