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