Your IP : 3.147.2.189


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/unbind-all.js

import Type from '../type';
import unbind from './unbind';
import registry from './registry';

export default function unbindAll(target: any, eventName?: string): void
{
	const events = registry.get(target);

	Object.keys(events).forEach((currentEvent) => {
		events[currentEvent].forEach((handler) => {
			if (!Type.isString(eventName) || eventName === currentEvent)
			{
				unbind(target, currentEvent, handler);
			}
		});
	});
}