
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Visi library has been written on vanilla.js and doesn't require any dependencies. It provides functionality to monitor events when some dom object becomes partially visible in viewport
Visi.js is a small library written on vanilla.js. It doesn't require any dependencies. Visi.js provides functionality to monitor when dom element is partially in a viewport It adds some methods to simplify your work with handling of such event.
Visi + animation Visi on jsfiddler (Watch console)
Remote
<script type="text/javascript"
src="https://cdn.rawgit.com/hellfrom/visi/master/visi.min.js"
></script>
npm
npm install visi
bower
bower install visi
Event names
visible and hidden
Short api
.add(domElements); //single or multiple dom elements
Short api
.add(domElements); //single or multiple dom elements
.on(eventName,function(changedElement,off){
//off() removes event listeners from fired element
});
.once(eventName,function(changedElement){
//...
});
var visi = Visi.add(/*dom elements*/);
visi.off(); //remove all event listeners from selection
var off = Visi.add(dom)
.on('visible',callback)
.getOff();
off(); //remove all listeners from selection
HTML
<div class = "p1"
id = "id1">
Lorem...
</div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<div class = "p2"
id = "id2">
Lorem ipsum...
</div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<div class = "p3 p1">
Lorem ipsum dolor...
</div>
JS
var visi = Visi.add(document.getElementById('id1'))
.on('visible',function(){
console.log('visible id1');
});
visi.off();
Add event to the same instance again
visi.on('visible',function(){
console.log('visible again');
});
Add event only once - after first triggering it will automatically unregister all event listeners
Visi.add(document.getElementById('id1')).once('hidden',function(element,off){
//off() is not necessary for this use case
//...
});
Listen if element becomes hidden every time with .on
Visi.add(document.querySelectorAll('.p1'))
.on('hidden',function(element,off){
console.log('hidden id1',element);
console.log(arguments);
//unregister listeners only for element which
//became hidden after some scrolling etc.
off();
});
Get unregisters
var off = Visi.add(document.getElementById('id1'))
.on('visible',function(){
console.log('visible id1');
}).getOff();
//remove all events from all dom elements for current selection
off();
FAQs
Visi library has been written on vanilla.js and doesn't require any dependencies. It provides functionality to monitor events when some dom object becomes partially visible in viewport
The npm package visi receives a total of 1 weekly downloads. As such, visi popularity was classified as not popular.
We found that visi 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.