Separate $.one event handler.

This commit is contained in:
Hyunje Alex Jun
2015-02-11 15:53:41 +00:00
parent 796a0a9093
commit 427284337f
2 changed files with 14 additions and 2 deletions
+11
View File
@@ -0,0 +1,11 @@
/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
* Licensed under the MIT License
*/
'use strict';
exports.once = function (element, eventName, handler) {
element.addEventListener(eventName, function (e) {
element.removeEventListener(eventName, handler, false);
handler(e);
}, false);
};