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.
@truffle/promise-tracker
Advanced tools
Readme
@truffle/promise-tracker
This library is used for keeping track of asynchronous work that needs to complete prior to the process exiting.
IMPORTANT Only use this library as a last resort. Typically you're better off architecting things so that you don't need process-level tracking of outstanding tasks.
Some alternatives to consider before using this module:
.then
and .catch
callbacks).Promise.race
For the moment promise tracking is implemented as a method decorator, meaning it must be applied to method declaration on a class.
It can be applied to any method, and it will only add special handling when methods return promises
import { tracked } from "@truffle/promise-tracker";
class Foo {
// totally fine, even though it doesn't return a promise
@tracked
synchronousBar(): "-" {
return "-";
}
@tracked
async asyncBar(): Promise<"-"> {
return "-";
}
// this works the same as with `asyncBar`, even though it's not explicitly an
// async method
@tracked
promiseBar(): Promise<"-"> {
return new Promise<"-">(resolve => resolve("-"));
}
}
import { waitForOutstandingPromises } from "@truffle/promiseTracker";
let exitCode = 0;
// If no catchHandler is passed, rejected promises are handled silently.
// This is because these promise rejections should already be handled by the
// caller that created the promise.
await waitForOutstandingPromises({ catchHandler: () => (exitCode = 1) });
process.exit(exitCode);
import { waitForOutstandingPromises } from "@truffle/promiseTracker";
let exitCode = 0;
// If no catchHandler is passed, rejected promises are handled silently.
// This is because these promise rejections should already be handled by the
// caller that created the promise.
waitForOutstandingPromises({ catchHandler: () => (exitCode = 1) }).then(() => {
process.exit(exitCode);
});
FAQs
A tool for wrangling async operations that need to complete before the truffle process exits
The npm package @truffle/promise-tracker receives a total of 12,260 weekly downloads. As such, @truffle/promise-tracker popularity was classified as popular.
We found that @truffle/promise-tracker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 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
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.