Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 0dae402

Browse files
committed
Add prop to customize emitted events, #53
1 parent f9e5acc commit 0dae402

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/component.vue

+8-4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
wrap: false
5151
})
5252
},
53+
events: {
54+
type: Array,
55+
default: () => hooks
56+
}
5357
},
5458
data() {
5559
return {
@@ -64,8 +68,8 @@
6468
/* istanbul ignore if */
6569
if (this.fp) return;
6670
67-
// Inject our method into hooks array
68-
hooks.forEach((hook) => {
71+
// Inject our method into events array
72+
this.events.forEach((hook) => {
6973
this.config[hook] = arrayify(this.config[hook] || []).concat((...args) => {
7074
this.$emit(camelToKebab(hook), ...args)
7175
});
@@ -104,8 +108,8 @@
104108
config: {
105109
deep: true,
106110
handler(newConfig) {
107-
// Workaround: Don't pass hooks to configs again
108-
hooks.forEach((hook) => {
111+
// Workaround: Don't pass events to configs again
112+
this.events.forEach((hook) => {
109113
delete newConfig[hook];
110114
});
111115
this.fp.set(newConfig);

0 commit comments

Comments
 (0)