mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
32 lines
876 B
JavaScript
32 lines
876 B
JavaScript
import Rule from "./Rule";
|
|
|
|
class DisplayManager {
|
|
|
|
constructor() {
|
|
this.rules = {};
|
|
this.ruleStatus = {}; // The current status for each rule. Maybe not necessary, for now just for logging.
|
|
|
|
document.ppcpDisplayManagerLog = () => {
|
|
console.log('DisplayManager', this);
|
|
}
|
|
}
|
|
|
|
addRule(ruleConfig) {
|
|
const updateStatus = () => {
|
|
this.ruleStatus[ruleConfig.key] = this.rules[ruleConfig.key].status;
|
|
console.log('ruleStatus', this.ruleStatus);
|
|
}
|
|
|
|
this.rules[ruleConfig.key] = new Rule(ruleConfig, updateStatus.bind(this));
|
|
console.log('Rule', this.rules[ruleConfig.key]);
|
|
}
|
|
|
|
register() {
|
|
this.ruleStatus = {};
|
|
for (const [key, rule] of Object.entries(this.rules)) {
|
|
rule.register();
|
|
}
|
|
}
|
|
}
|
|
|
|
export default DisplayManager;
|