Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

54 rindas
1.1 KiB

  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'jquery',
  7. 'jquery/ui'
  8. ], function ($) {
  9. 'use strict';
  10. $.widget('ui.button', $.ui.button, {
  11. options: {
  12. eventData: {},
  13. waitTillResolved: true
  14. },
  15. /**
  16. * Button creation.
  17. * @protected
  18. */
  19. _create: function () {
  20. if (this.options.event) {
  21. this.options.target = this.options.target || this.element;
  22. this._bind();
  23. }
  24. this._super();
  25. },
  26. /**
  27. * Bind handler on button click.
  28. * @protected
  29. */
  30. _bind: function () {
  31. this.element
  32. .off('click.button')
  33. .on('click.button', $.proxy(this._click, this));
  34. },
  35. /**
  36. * Button click handler.
  37. * @protected
  38. */
  39. _click: function () {
  40. var options = this.options;
  41. $(options.target).trigger(options.event, [options.eventData]);
  42. }
  43. });
  44. return $.ui.button;
  45. });