mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
28 lines
No EOL
694 B
JavaScript
28 lines
No EOL
694 B
JavaScript
class CartBootstrap {
|
|
constructor(gateway, renderer, configurator) {
|
|
this.gateway = gateway;
|
|
this.renderer = renderer;
|
|
this.configurator = configurator;
|
|
}
|
|
|
|
init() {
|
|
if (!this.shouldRender()) {
|
|
return;
|
|
}
|
|
|
|
jQuery(document.body).on('updated_cart_totals updated_checkout', () => {
|
|
this.renderer.render(this.configurator.configuration());
|
|
});
|
|
|
|
this.renderer.render(
|
|
this.gateway.button.wrapper,
|
|
this.configurator.configuration(),
|
|
);
|
|
}
|
|
|
|
shouldRender() {
|
|
return document.querySelector(this.gateway.button.wrapper);
|
|
}
|
|
}
|
|
|
|
export default CartBootstrap; |