@inkline/inkline
Version:
Inkline is the Vue.js UI/UX Library built for creating your next design system
16 lines (12 loc) • 387 B
text/typescript
import { off } from './off';
import { on } from './on';
export const once = function (el: HTMLElement, event: string, fn: any): void {
const listener = function (...args: any[]) {
if (fn) {
// @ts-ignore
fn.apply(this, args); // eslint-disable-line no-invalid-this
}
off(el, event, listener);
};
on(el, event, listener);
};