Skip to content

Commit 65ed81a

Browse files
committed
feat(options): add 'vueInstanceCreatedCallback' that is triggered after new Vue()
1 parent e46f03c commit 65ed81a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ Additional, optional, third parameter to `Vue.customElement()` is options object
163163
return RootComponentDefinition;
164164
},
165165

166+
// Vue instance is created
167+
vueInstanceCreatedCallback() {
168+
console.info('vueInstanceCreatedCallback');
169+
},
170+
166171
// in case of using vue-custom-element with modals, we destroy it after defined timeout
167172
destroyTimeout: 3000,
168173

src/vue-custom-element.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ function install(Vue) {
2828
asyncComponentPromise.then((lazyLoadedComponent) => {
2929
const lazyLoadedComponentProps = getProps(lazyLoadedComponent);
3030
createVueInstance(this, Vue, lazyLoadedComponent, lazyLoadedComponentProps, options);
31+
typeof options.vueInstanceCreatedCallback === 'function' && options.vueInstanceCreatedCallback.call(this);
3132
});
3233
} else {
3334
createVueInstance(this, Vue, componentDefinition, props, options);
35+
typeof options.vueInstanceCreatedCallback === 'function' && options.vueInstanceCreatedCallback.call(this);
3436
}
3537
}
3638

0 commit comments

Comments
 (0)