
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
A tiny utility library to conveniently replace callbacks with Promises.
A tiny utility library to replace callbacks with Promises where possible. Don't callback, callforth!
It simply includes a hand-full of functions I see myself re-implementing in nearly every project. So I might as well put them in a package.
Do things like:
await timeout(3000)
await eventOn(videoElement, "loadeddata")
const message = await eventOn(webWorker, "message")
npm install callforth
Now you can:
import { eventOn, timeout, polling } from "callforth"
Alternatively, include this script and:
<script src="./path/to/callforth.umd.js"></script>
<script>
const { eventOn, timeout, polling } = window.callforth
</script>
eventOn
const payload = await eventOn(target, successEvent, errorEvent)
EventTarget
- any object you can call addEventListener
on.string
- name of the event you want to await.string
(optional) - if this event fires, the promise is rejected.Promise<any>
- wraps callback result (callbacks first argument)timeout
await timeout(delay)
int
- milliseconds after which the Promise should resolves.Promise<void>
polling
await polling(predicate, { maxTries, interval })
any -> boolean
- delay in milliseconds after which the Promise should resolve.object
(optional)
int
(default = 10) - maximum number of times to call predicate before giving up.int
(default = 10) - delay in milliseconds between calls of predicate.Promise<void>
async function loadScript(url) {
let script = document.createElement("script")
script.src = url
await eventOn(script, "loaded")
}
async function primesLessThen(number) {
primeWorker.postMessage(number)
const result = await eventOn(primeWorker, "message")
return result
}
FAQs
A tiny utility library to conveniently replace callbacks with Promises.
The npm package callforth receives a total of 17,456 weekly downloads. As such, callforth popularity was classified as popular.
We found that callforth 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
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.