mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 18:00:15 +08:00
Pass the Renderer as a dependency
This commit is contained in:
parent
986cec7fef
commit
e3041ed5e6
6 changed files with 54 additions and 49 deletions
|
@ -1,7 +1,6 @@
|
|||
import Renderer from './Renderer';
|
||||
|
||||
class MiniCartBootstap {
|
||||
constructor(configurator) {
|
||||
constructor(renderer, configurator) {
|
||||
this.renderer = renderer;
|
||||
this.configurator = configurator;
|
||||
}
|
||||
|
||||
|
@ -10,18 +9,19 @@ class MiniCartBootstap {
|
|||
return;
|
||||
}
|
||||
|
||||
const renderer = new Renderer(PayPalCommerceGateway.button.mini_cart_wrapper);
|
||||
|
||||
jQuery(document.body).
|
||||
on('wc_fragments_loaded wc_fragments_refreshed', () => {
|
||||
renderer.render(this.configurator.configuration());
|
||||
});
|
||||
|
||||
renderer.render(this.configurator.configuration());
|
||||
this.renderer.render(
|
||||
PayPalCommerceGateway.button.mini_cart_wrapper,
|
||||
this.configurator.configuration(),
|
||||
);
|
||||
}
|
||||
|
||||
shouldRender() {
|
||||
return document.querySelector(PayPalCommerceGateway.button.mini_cart_wrapper)
|
||||
return document.querySelector(PayPalCommerceGateway.button.mini_cart_wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue