Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
jquery-once
Advanced tools
Act on jQuery elements only once.
Filters out all elements that had the same filter applied on them before. It can be used to ensure that a function is only applied once to an element.
require('jquery-once')
npm install --save jquery-once
require('jquery-once')
npm install --save jquery-once
//wzrd.in/bundle/jquery-once@2.0.0-alpha.8
require('jquery-once')
ender add jquery-once
require('jquery-once')
component install RobLoach/jquery-once
require('jquery-once')
bower install jquery-once
.once()
Filter elements by whether they have not yet been processed.
$('div.calendar').once('calendar').each(function() {
// This function is only executed once for each div, even if this
// code segment is executed repeatedly.
});
$('div.calendar').once('calendar').click(function() {
// .once('calendar') filters out all elements which already have been
// filtered with once(), and the elements that haven't been filtered
// yet remain. The previous set of elements can be restored with
// .end().
});
It is also possible to use .once()
without supplying a name:
$('div.calendar').once().each(function() {
// This function is only executed once for each div, even if this
// code segment is executed repeatedly. Other scripts can't refer
// to this `once` method. The once data used to store execution are
// in the form "jquery-once-1", "jquery-once-2", etc.
});
.findOnce()
After .once()
is used and you need to retrieve all elements that have already
been executed with .once()
, you can use the `.findOnce() function:
$('div.calendar').findOnce('calendar').each(function() {
// This function is called for each element that was already called "once"
// with the "calendar" ID.
});
.removeOnce()
It is possible to remove the .once()
data, and iterate through each element
whose once state is removed:
$('div.calendar').removeOnce('calendar').each(function() {
// This function is called for each element whose once() data is removed.
});
Install dependencies through npm:
npm install
grunt jshint qunit
Build the project with Grunt:
grunt release
Update project documentation with Projectz:
npm run-script projectz
Generate code documentation with JSDoc:
npm run-script jsdoc
Discover the change history by heading on over to the HISTORY.md
file.
Licensed under:
Copyright © Rob Loach (http://github.com/RobLoach)
These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
These amazing people have contributed code to this project:
FAQs
Act on jQuery elements only once.
The npm package jquery-once receives a total of 1,795 weekly downloads. As such, jquery-once popularity was classified as popular.
We found that jquery-once demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.