Skip to content

Commit

Permalink
Remove duplicate emit calls and fix event handler function declaratio…
Browse files Browse the repository at this point in the history
…n for collapse, fixes bootstrap-vue#12.
  • Loading branch information
michaelwoodson committed Oct 21, 2016
1 parent 69e0e26 commit e0b3896
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions components/collapse-toggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
// broadcast accordion toggle if both id and group are set otherwise broadcast collapse
// we also use dispatch to tell other components about the change
if (this.target && this.targetGroup) {
this.$root.$emit('toggled::accordion', {id: this.target, group: this.targetGroup});
this.$root.$emit('toggled::accordion', {id: this.target, group: this.targetGroup})
} else {
this.$root.$emit('toggled::collapse', {id: this.target, group: this.targetGroup});
this.$root.$emit('toggled::collapse', {id: this.target, group: this.targetGroup})
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/collapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
created: function () {
const hub = this.$root;
hub.$on('toggled::collapse', function (data) {
hub.$on('toggled::collapse', (data) => {
if (data.id && data.id === this.id && !data.group || data.group && data.group === this.group && !data.id) {
if ((this.$el.className + ' ').indexOf(' in ') > -1) {
this.hide()
Expand All @@ -62,7 +62,7 @@
}
});
hub.$on('toggled::accordion', function (data) {
hub.$on('toggled::accordion', (data) => {
// if id and group id is provided it means it is an accordion and takes priority over all
if (data.id && data.group && data.group === this.group) {
// for current element
Expand Down

0 comments on commit e0b3896

Please sign in to comment.