Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. /**
  2. * Hold the wish quick submitter presentation logic
  3. *
  4. * Here we add a new wish
  5. *
  6. * @constructor
  7. */
  8. let WishQuickSubmitterView = function() {};
  9.  
  10. WishQuickSubmitterView.prototype.initEvents = function () {
  11. this.publishers();
  12. };
  13.  
  14. /**
  15. * Publish messages on corresponding DOM events
  16. */
  17. WishQuickSubmitterView.prototype.publishers = function() {
  18. // Handle wish addition
  19. $('.wish-quick-submitter .wish-add').on('click', function() {
  20. let name = $('.wish-quick-submitter input[name="name"]').val();
  21. let price = parseFloat($('.wish-quick-submitter input[name="price"]').val());
  22.  
  23. // Publish a message with corresponding wish data, that a wish is being added
  24. $.Topic( "wish-add" ).publish( {name, price} );
  25. });
  26. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement