
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
You're waiting for some arbitrary thing to load in your browser, or for something to happen, but that thing doesn't have an evented interface. What a pain in the butt.
wen to the rescue!
var wen = require('wen');
var truth = wen();
var somePredicate; // Currently falsy
truth.on('the-thing-happened', function () {
console.log('React to the thing that happened here!');
});
truth.add(function () {
// At some point, some external force made somePredicate truthy
return somePredicate;
}, 'the-thing-happened');
npm install wen --save
Copy this into your HTML somewhere.
<script src="https://raw.githubusercontent.com/basicallydan/wen/master/dist/wen.1.0.1.min.js"></script>
<!-- If I want to do this properly I will download it and place it in my source code somewhere -->
Simple.
Easy: you give it a predicate and some event name (whatever you want!), it checks every 1000ms (or less, or more, if you specify) if that predicate is truthy. When it finally is truthy, it'll trigger that event name. It extends an Event Emitter, so in fact it will also have all of the methods of the event emitter, such as .once and .trigger.
There are only two direct dependencies. For the compiled .min.js version they are bundled so don't worry about it. They are:
This makes for a total of two dependencies. You could probably read the entire source in about half an hour. I dare you.
makefile files for?Contributors who want to bundle the JS into the minified form (for the spec, too). Don't touch 'em unless you know what you're doing!
Sure you can! If you have a suggestion, make an issue. If you've fixed something, open a pull request. This is a very simple module.
Dan Hough (@basicallydan on Twitter and everywhere) did, while he was working as a contractor for upmysport.
FAQs
Triggers events based on the truthiness of predicate methods
The npm package wen receives a total of 10 weekly downloads. As such, wen popularity was classified as not popular.
We found that wen 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
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.