12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- "use strict";
- class BasicEffectRulePlugin {
-
- constructor(ruleProperty, effectType) {
- this.ruleProperty = ruleProperty;
- this.effectType = effectType || ruleProperty;
- }
-
- apply(ruleSetCompiler) {
- ruleSetCompiler.hooks.rule.tap(
- "BasicEffectRulePlugin",
- (path, rule, unhandledProperties, result, references) => {
- if (unhandledProperties.has(this.ruleProperty)) {
- unhandledProperties.delete(this.ruleProperty);
- const value = rule[this.ruleProperty];
- result.effects.push({
- type: this.effectType,
- value
- });
- }
- }
- );
- }
- }
- module.exports = BasicEffectRulePlugin;
|