Separate $.one event handler.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user