idealista-enhancer/src/Event.js

13 lines
314 B
JavaScript
Raw Normal View History

import Log from "./Log.js";
export default class Event {
static click(selector, callback) {
document.addEventListener('click', (event) => {
if (!event.target.matches(selector)) return;
Log.debug(`Click on: ${selector}`)
callback(event.target);
});
}
}