Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
attr-bind-change
Advanced tools
This is just a fork of substack's attr-bind
except that it only listens to onchange
events and
not on keyup
and keydown
.
<!doctype html>
<html>
<body>
<div>
<label>Name:</label>
<input type="text" binder="user-name" placeholder="Enter a name here">
<hr>
<h1>Hello <span binder="user-name"></span>!</h1>
</div>
<script src="bundle.js"></script>
</body>
</html>
var bind = require('attr-bind')();
var elems = document.querySelectorAll('*[binder]');
for (var i = 0; i < elems.length; i++) bind(elems[i]);
or you can use attractor:
var bind = require('attr-bind')();
var attr = require('attractor')({ binder: bind });
attr.scan(document);
Now the contents of the span tag update as you edit the input box.
If you want to capture the updated values programmatically, you can pass in an observable in place of an element:
var watch = require('observable')();
watch(function (value) {
console.log('value=' + value);
});
bind(watch, 'key');
var binder = require('attr-bind')
Return a bind()
function. Optionally you can pass in an
observable()-style
function watcher fn
.
Bind the element or observable elem
to
the key at key
.
Look at ctx.scope
for scope information. If there isn't already an entry set
for ctx.scope[key]
, create a new scope entry with
observ.
ctx.scope[key].set(newVal)
.ctx.scope[key]()
.ctx.scope[key](function (newVal) {})
.With npm do:
npm install attr-bind
MIT
FAQs
2-way dom element binding
We found that attr-bind-change 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.