woocommerce-paypal-payments/modules/ppcp-axo/resources/js/Components/DomElement.js
2024-03-12 09:23:42 +00:00

36 lines
857 B
JavaScript

import {setVisible} from "../../../../ppcp-button/resources/js/modules/Helper/Hiding";
class DomElement {
constructor(config) {
this.$ = jQuery;
this.config = config;
this.selector = this.config.selector;
this.id = this.config.id || null;
this.className = this.config.className || null;
this.attributes = this.config.attributes || null;
this.anchorSelector = this.config.anchorSelector || null;
}
trigger(action) {
this.$(this.selector).trigger(action);
}
on(action, callable) {
this.$(document).on(action, this.selector, callable);
}
hide() {
this.$(this.selector).hide();
}
show() {
this.$(this.selector).show();
}
click() {
document.querySelector(this.selector).click();
}
}
export default DomElement;