fix(core): Don't load plugins twice
This commit is contained in:
parent
07528ecf95
commit
c79aea43b9
1 changed files with 6 additions and 0 deletions
|
@ -47,6 +47,9 @@ export function Pattern(config = { options: {} }) {
|
|||
warning: [],
|
||||
}
|
||||
|
||||
// Keep track of loaded plugins
|
||||
this.plugins = {}
|
||||
|
||||
// Raise methods - Make events and settings avialable in them
|
||||
const events = this.events
|
||||
const settings = this.settings
|
||||
|
@ -536,6 +539,9 @@ Pattern.prototype.on = function (hook, method, data) {
|
|||
}
|
||||
|
||||
Pattern.prototype.use = function (plugin, data) {
|
||||
// Don't load plugins more than once
|
||||
if (this.plugins?.[plugin.name]) return this
|
||||
this.plugins[plugin.name] = plugin
|
||||
// Conditional plugin?
|
||||
if (plugin.plugin && plugin.condition) return this.useIf(plugin, data)
|
||||
// Regular plugin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue