Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jquery-once

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-once

Act on jQuery elements only once.

  • 2.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9K
decreased by-52.7%
Maintainers
2
Weekly downloads
 
Created
Source

jQuery Once NPM version

Build Status NPM downloads Dependency Status Coverage Status

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.

Install

MethodInstallation
npmnpm install jquery-once --save
Composercomposer require robloach/jquery-once
Bowerbower install jquery-once
Componentcomponent install RobLoach/jquery-once
jsDelivr//cdn.jsdelivr.net/jquery.once/2.1.1/jquery.once.min.js
cdnjs//cdnjs.cloudflare.com/ajax/libs/jquery-once/2.1.1/jquery.once.js

Usage

See the API documentation for more information on how to use jQuery Once.

// The following will change the color of each paragraph to red, just once
// for the "changecolor" key.
$('p').once('changecolor').css('color', 'red');

// .once() will return a set of elements that yet to have the once ID
// associated with them. You can return to the original collection set by
// using .end().
$('p')
  .once("changecolorblue")
    .css("color", "blue")
  .end()
  .css("color", "red");

// To execute a function on the once set, you can use jQuery's each().
$('div.calendar').once().each(function() {
  // Since there is no once ID provided here, the key will be "once".
});

Development

  1. Ensure you are using node >= 4:
node --version
  1. Install dependencies through npm:
npm install
  1. Check coding style standard, and automated testing:
npm test
  1. Build jquery.once.min.js with:
npm run build
  1. Update API documentation:
npm run docs
  1. Tag and publish the new versions to npm with Semantic Versioning:
git add -A
git commit -m "2.1.2"
git tag 2.1.2
git push origin 2.1.2
npm publish

Docker

It is possible to run tests through Docker Compose:

docker-compose up

Change Log

Discover the change history by heading on over to the CHANGELOG.md file.

License

Dual licensed under:

Copyright © Rob Loach

Keywords

FAQs

Package last updated on 16 Jun 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc