core: make mount()ing an unknown plugin a noop

This commit is contained in:
Renée Kooi 2017-09-04 14:59:37 +02:00
parent 36365b90f9
commit 9174abf855
No known key found for this signature in database
GPG key ID: 30516CF2A8E63718

View file

@ -73,24 +73,27 @@ module.exports = class Plugin {
targetElement.appendChild(this.el)
return targetElement
} else {
const Target = target
// Find the target plugin instance.
let targetPlugin
this.core.iteratePlugins((plugin) => {
if (plugin instanceof Target) {
targetPlugin = plugin
return false
}
})
const targetPluginName = targetPlugin.id
this.core.log(`Installing ${callerPluginName} to ${targetPluginName}`)
const selectorTarget = targetPlugin.addTarget(plugin)
return selectorTarget
}
const Target = target
// Find the target plugin instance.
let targetPlugin
this.core.iteratePlugins((plugin) => {
if (plugin instanceof Target) {
targetPlugin = plugin
return false
}
})
if (targetPlugin) {
const targetPluginName = targetPlugin.id
this.core.log(`Installing ${callerPluginName} to ${targetPluginName}`)
return targetPlugin.addTarget(plugin)
}
this.core.log(`Not installing ${callerPluginName}`)
return null
}
unmount () {