rule.js 691 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'uiClass',
  7. 'Magento_Paypal/js/rules'
  8. ], function (Class, Rules) {
  9. 'use strict';
  10. return Class.extend({
  11. /**
  12. * Constructor
  13. *
  14. * @param {Object} config
  15. * @returns {exports.initialize}
  16. */
  17. initialize: function (config) {
  18. this.rules = new Rules();
  19. this.initConfig(config);
  20. return this;
  21. },
  22. /**
  23. * To apply the rule
  24. */
  25. apply: function () {
  26. this.rules[this.name](this.$target, this.$owner, this.data);
  27. }
  28. });
  29. });