mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
27 lines
674 B
JavaScript
27 lines
674 B
JavaScript
import BaseCondition from "./BaseCondition";
|
|
import {inputValue} from "../../../helper/form";
|
|
|
|
class ElementCondition extends BaseCondition {
|
|
|
|
register() {
|
|
jQuery(document).on('change', this.config.selector, () => {
|
|
const status = this.check();
|
|
if (status !== this.status) {
|
|
this.status = status;
|
|
this.triggerUpdate();
|
|
}
|
|
});
|
|
|
|
this.status = this.check();
|
|
}
|
|
|
|
check() {
|
|
let value = inputValue(this.config.selector);
|
|
value = (value !== null ? value.toString() : value);
|
|
|
|
return this.config.value === value;
|
|
}
|
|
|
|
}
|
|
|
|
export default ElementCondition;
|