jamon.js
function getProxiedListener (listener, selector) {
			// get existing proxy storage of the listener
			let proxies = listener[proxyKey];
			// the proxy to return
			let proxy;

			// or create the storage
			if (isUndefined(proxies)) {
				proxies = new Map();
				listener[proxyKey] = proxies;
			}

			if (proxies.has(selector)) {
				// a proxy for this selector already exists - get it
				proxy = proxies.get(selector);
			} else {
				// create a new proxy for this selector
				proxy = function (e) {
					const target = e.target;
					// only call the listener if the target matches the selector
					if (target.matches(selector)) {
						listener.call(target, e);
					}
				}
				// store proxy
				proxies.set(selector, proxy);
			}

			return proxy;
	}
function getProxiedListener (listener, selector) {
			// get existing proxy storage of the listener
			let proxies = listener[proxyKey];
			// the proxy to return
			let proxy;

			// or create the storage
			if (isUndefined(proxies)) {
				proxies = new Map();
				listener[proxyKey] = proxies;
			}

			if (proxies.has(selector)) {
				// a proxy for this selector already exists - get it
				proxy = proxies.get(selector);
			} else {
				// create a new proxy for this selector
				proxy = function (e) {
					const target = e.target;
					// only call the listener if the target matches the selector
					if (target.matches(selector)) {
						listener.call(target, e);
					}
				}
				// store proxy
				proxies.set(selector, proxy);
			}

			return proxy;
	}
function getProxiedListener ( listener , selector ) { // get existing proxy storage of the listener let proxies = listener [ proxyKey ] ; // the proxy to return let proxy ; // or create the storage if ( isUndefined ( proxies ) ) { proxies = new Map ( ) ; listener [ proxyKey ] = proxies ; } if ( proxies . has ( selector ) ) { // a proxy for this selector already exists - get it proxy = proxies . get ( selector ) ; } else { // create a new proxy for this selector proxy = function ( e ) { const target = e . target ; // only call the listener if the target matches the selector if ( target . matches ( selector ) ) { listener . call ( target , e ) ; } } // store proxy proxies . set ( selector , proxy ) ; } return proxy ; }
Generate a proxy for the given listener-selector combination
@private
@param {Function} listener - the listener function
@param {string} selector - the selector
@return {Function} - the listener or the proxy
Generate a proxy for the given listener - selector combination