summaryrefslogtreecommitdiffstats
path: root/jquery.once.js
blob: a547c1a7a89ea0cc2d728175b201117cd30906ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Generated by CoffeeScript 1.8.0
(function() {
  (function(factory) {
    if (typeof exports === "object") {
      factory(require("jquery"));
    } else if (typeof define === "function" && define.amd) {
      define(["jquery"], factory);
    } else {
      factory(jQuery);
    }
  })(function($) {
    var uuid;
    uuid = 0;
    $.fn.once = function(id) {
      var name;
      if (!id) {
        throw new Error("An ID is required when calling jQuery.once()");
      }
      name = "jquery-once-" + id;
      return this.filter(function() {
        return $(this).data(name) !== true;
      }).data(name, true);
    };
    $.fn.removeOnce = function(id) {
      return this.findOnce(id).removeData("jquery-once-" + id);
    };
    $.fn.findOnce = function(id) {
      var name;
      name = "jquery-once-" + id;
      return this.filter(function() {
        return $(this).data(name) === true;
      });
    };
  });

}).call(this);

//# sourceMappingURL=jquery.once.js.map