Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@repeaterjs/timers
Advanced tools
Changelog
limiters@0.3.3 - 2019-10-13
Readme
This package is experimental!
Cancelable timers, implemented with repeaters
For more information, visit repeater.js.org.
function delay(wait: number): Repeater<number>;
delay
returns a repeater which yields Date.now()
wait
milliseconds after next
is called. Each call to next
runs an independent timer. All outstanding timers can be canceled by calling return
.
function timeout(wait: number): Repeater<undefined>;
timeout
returns a repeater which rejects with a TimeoutError
if the repeater does not receive another call to next
or return
after the specified wait
. This behavior is useful when you want to place a fixed upper bound on how long each iteration of an async iterator can take with Repeater.race
.
import { Repeater } from "@repeaterjs/repeater";
import { timeout } from "@repeaterjs/timers";
const repeater = new Repeater(async (push) => {
await push(1);
await push(2);
await new Promise((resolve) => setTimeout(resolve, 2000));
await push(3);
});
try {
(async () => {
for await (const num of Repeater.race([repeater, timeout(1000)])) {
console.log(num); // 1, 2
}
})();
} catch (err) {
console.log(err); // TimeoutError: 1000 ms elapsed
}
function interval(wait: number, buffer?: RepeaterBuffer<number>): Repeater<number>;
interval
returns a repeater which resolves with the current timestamp every wait
milliseconds. The timer does not start until you call next
on the returned iterator, and can be canceled by calling return
.
FAQs
Async iterator timer functions
The npm package @repeaterjs/timers receives a total of 187 weekly downloads. As such, @repeaterjs/timers popularity was classified as not popular.
We found that @repeaterjs/timers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.