mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
27 lines
No EOL
658 B
JavaScript
27 lines
No EOL
658 B
JavaScript
import Renderer from './Renderer';
|
|
|
|
class CartBootstrap {
|
|
constructor(configurator) {
|
|
this.configurator = configurator;
|
|
}
|
|
|
|
init() {
|
|
if (!this.shouldRender()) {
|
|
return;
|
|
}
|
|
|
|
const renderer = new Renderer(PayPalCommerceGateway.button.wrapper);
|
|
|
|
jQuery(document.body).on('updated_cart_totals updated_checkout', () => {
|
|
renderer.render(this.configurator.configuration());
|
|
});
|
|
|
|
renderer.render(this.configurator.configuration());
|
|
}
|
|
|
|
shouldRender() {
|
|
return document.querySelector(PayPalCommerceGateway.button.wrapper);
|
|
}
|
|
}
|
|
|
|
export default CartBootstrap; |