Skip to content

Commit a2a3e30

Browse files
authored
once
1 parent 307bbd9 commit a2a3e30

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

once event

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function once(callback) {
2+
const handler = (e) => {
3+
e.currentTarget.removeEventListener(e.type, handler);
4+
callback(e);
5+
};
6+
7+
return handler;
8+
}

0 commit comments

Comments
 (0)