composite.js 886 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. /**
  6. * @deprecated since version 2.2.0
  7. */
  8. /* eslint-disable strict */
  9. define(['jquery'], function ($) {
  10. return function () {
  11. var renderedChildren = {},
  12. children = {};
  13. return {
  14. /**
  15. * @param {*} child
  16. * @param {String} key
  17. */
  18. addChild: function (child, key) {
  19. children[key] = child;
  20. },
  21. /**
  22. * @param {*} root
  23. */
  24. render: function (root) {
  25. $.each(children, function (key, child) {
  26. var childRoot = $('<div>');
  27. renderedChildren[key] = child.render(childRoot);
  28. root.append(childRoot);
  29. });
  30. }
  31. };
  32. };
  33. });