JSPM

  • Created
  • Published
  • Downloads 3704
  • Score
    100M100P100Q121784F

Act on jQuery elements only once.

Package Exports

  • jquery-once

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jquery-once) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

jQuery Once

Build Status NPM version Dependency Status Development Dependency Status
Gittip donate button

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

NPM

  • Use: require('jquery-once')
  • Install: npm install --save jquery-once

Browserify

  • Use: require('jquery-once')
  • Install: npm install --save jquery-once
  • CDN URL: //wzrd.in/bundle/jquery-once@2.0.0-alpha.2

Ender

  • Use: require('jquery-once')
  • Install: ender add jquery-once

Component

  • Use: require('jquery-once')
  • Install: component install robloach/jquery-once

Bower

  • Use: require('jquery-once')
  • Install: bower install jquery-once

Usage

$('div.calendar').once('calendar', 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 also works without supplying a name:

$('div.calendar').once(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.
});

Develop

Leverage npm, grunt, qunit and projectz:

$ npm install
$ npm test
$ grunt release
$ npm run-script projectz

History

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

License

Licensed under:

Copyright © Rob Loach robloach@gmail.com (http://github.com/robloach)

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

Gittip donate button

Contributors

These amazing people have contributed code to this project:

Become a contributor!