Skip to content

Commit

Permalink
feat(base): shouldBubble now defaults to true
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The `shouldBubble` param of `MDCComponent.emit()` now defaults to `true` instead of `false`.
  • Loading branch information
acdvorak committed Jan 19, 2018
1 parent d363411 commit 4c08741
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/mdc-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class MyComponent extends MDCComponent {
| `destroy()` | Subclasses may override this method if they wish to perform any additional cleanup work when a component is destroyed. For example, a component may want to deregister a window resize listener. |
| `listen(type: string, handler: EventListener)` | Adds an event listener to the component's root node for the given `type`. Note that this is simply a proxy to `this.root_.addEventListener`. |
| `unlisten(type: string, handler: EventListener)` | Removes an event listener from the component's root node. Note that this is simply a proxy to `this.root_.removeEventListener`. |
| `emit(type: string, data: Object, shouldBubble: boolean = false)` | Dispatches a custom event of type `type` with detail `data` from the component's root node. It also takes an optional shouldBubble argument to specify if the event should bubble. This is the preferred way of dispatching events within our vanilla components. |
| `emit(type: string, data: Object, shouldBubble: boolean = true)` | Dispatches a custom event of type `type` with detail `data` from the component's root node. It also takes an optional shouldBubble argument to specify if the event should bubble. This is the preferred way of dispatching events within our vanilla components. |

#### Static Methods

Expand Down
2 changes: 1 addition & 1 deletion packages/mdc-base/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class MDCComponent {
* @param {!Object} evtData
* @param {boolean=} shouldBubble
*/
emit(evtType, evtData, shouldBubble = false) {
emit(evtType, evtData, shouldBubble = true) {
let evt;
if (typeof CustomEvent === 'function') {
evt = new CustomEvent(evtType, {
Expand Down

0 comments on commit 4c08741

Please sign in to comment.