mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
24 lines
558 B
JavaScript
24 lines
558 B
JavaScript
import BaseCondition from "./BaseCondition";
|
|
|
|
class JsVariableCondition extends BaseCondition {
|
|
|
|
register() {
|
|
jQuery(document).on('ppcp-display-change', () => {
|
|
const status = this.check();
|
|
if (status !== this.status) {
|
|
this.status = status;
|
|
this.triggerUpdate();
|
|
}
|
|
});
|
|
|
|
this.status = this.check();
|
|
}
|
|
|
|
check() {
|
|
let value = document[this.config.variable];
|
|
return this.config.value === value;
|
|
}
|
|
|
|
}
|
|
|
|
export default JsVariableCondition;
|