Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core): allow classes to be passed as plugins #588

Merged
merged 3 commits into from
Jan 8, 2020

Conversation

KaelWD
Copy link
Contributor

@KaelWD KaelWD commented Jan 6, 2020

In vue 2.x we could pass a class to Vue.use() with a static install method as it checked for PluginObject first.

https://github.com/vuejs/vue/blob/6fe07ebf5ab3fea1860c59fe7cdd2ec1b760f9b0/src/core/global-api/use.js#L15

@KaelWD KaelWD changed the title fix(core): allow classes to be passed as plugins fix(runtime-core): allow classes to be passed as plugins Jan 7, 2020
@@ -103,12 +103,16 @@ export function createAppAPI<HostNode, HostElement>(
use(plugin: Plugin, ...options: any[]) {
if (installedPlugins.has(plugin)) {
__DEV__ && warn(`Plugin has already been applied to target app.`)
} else if (
plugin &&
'install' in plugin &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript complains without it (plugin still includes PluginInstallFunction), it was either this or a bunch of type assertion.

@yyx990803 yyx990803 merged commit 8f616a8 into vuejs:master Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants