Your IP : 18.116.63.107


Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/main/core/src/lib/event/
Upload File :
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/main/core/src/lib/event/bind-once.js

import bind from './bind';
import unbind from './unbind';

export default function bindOnce(
	target: Element,
	eventName: string,
	handler: (event: Event) => void,
	options?: {
		capture?: boolean,
		once?: boolean,
		passive?: boolean,
	},
): void
{
	const once = function once(...args) {
		unbind(target, eventName, once, options);
		handler(...args);
	};

	bind(target, eventName, once, options);
}