Remove YUI event code - #184
Conversation
0f27691 to
8267987
Compare
| } | ||
| } | ||
| // increase value on mouse movement | ||
| const handleMouseMove = (e, progress_bar) => { |
There was a problem hiding this comment.
This doesn't need multiple params as download_progress_obj will be available in the outer scope. It could be inline in the addEventListener using a standard arrow function. The other even handlers are also only used once and could be declared inline inside addEventListener.
| upload_progress_obj.setText(value + '% complete'); | ||
| } | ||
| // set random value on mouse click | ||
| const handleClick = (e, progress_bar) => { |
There was a problem hiding this comment.
This doesn't need multiple params and can be declared inline.
| }); | ||
|
|
||
| this.changeValueEvent.fire(this.value); | ||
| this.dispatchEvent( |
There was a problem hiding this comment.
This looks really good. Because we use dispatchEvent we should also be able to use e.target inside an event handler to access the progress bar instance.
| upload_progress_obj.setText(value + '% complete'); | ||
| } | ||
| // set random value on mouse click | ||
| const handleClick = (e, progress_bar) => { |
There was a problem hiding this comment.
e.target should also be the progress bar instance and could be a better pattern to use than relying on the shared variable scope.
619a29f to
e5a92b6
Compare
| simple_color_entry_obj.colorChangeEvent.subscribe( | ||
| handleColorChange); | ||
| </script> | ||
| simple_color_entry_obj.addEventListener('colorChange', (e) => { |
| parent::__construct($id); | ||
|
|
||
| $yui = new SwatYUI(['dom', 'event', 'animation']); | ||
| $yui = new SwatYUI(['dom', 'animation']); |
| $this->requires_id = true; | ||
|
|
||
| $yui = new SwatYUI(['yahoo', 'dom', 'event', 'animation']); | ||
| $yui = new SwatYUI(['animation']); |
There was a problem hiding this comment.
Can drop animations util. It uses DOM animations.
| { | ||
| parent::__construct($id); | ||
|
|
||
| $yui = new SwatYUI(['dom', 'event', 'animation']); |
| $this->requires_id = true; | ||
|
|
||
| $yui = new SwatYUI(['dom', 'event', 'animation', 'selector']); | ||
| $yui = new SwatYUI(['animation']); |
There was a problem hiding this comment.
Can drop animation as well. It uses DOM animations.
| if (temp != hidden_field.value) { | ||
| this.orderChangeEvent.fire(temp); | ||
| this.dispatchEvent( | ||
| new CustomEvent('orderChange', { |
|
|
||
| if ( | ||
| this.pulse_direction == 1 && | ||
| this.pulse_direction === 1 && |
There was a problem hiding this comment.
Could be moved to a static property DIRECTION_FORWARD
|
|
||
| if ( | ||
| this.pulse_direction == -1 && | ||
| this.pulse_direction === -1 && |
There was a problem hiding this comment.
Could be moved to a static property DIRECTION_BACKWARD
| const event_color = color === null ? null : '#' + color; | ||
|
|
||
| this.dispatchEvent( | ||
| new CustomEvent('colorChange', { |
| * This is the base class used for recordset views. It is primarily | ||
| * responsible for providing helper methods for dynamically highlighting | ||
| * selecgted items in the view. | ||
| * selected items in the view. |
Refactors and removes any event-based code that relied on YUI to set up ... and replaces it with vanilla JS
EventTarget-based code.There are also some other changes that got looped in as well, mostly because this started out as a PR to remove YUI entirely. I also cleaned up the demo that ships with the package a bit, so that all of these changes can be tested via http://localhost:8888/ (see the
README.mdfor details).