diff --git a/src/plugins/Plugin.js b/src/plugins/Plugin.js index 7cfef6e04..3967a642f 100644 --- a/src/plugins/Plugin.js +++ b/src/plugins/Plugin.js @@ -1,3 +1,5 @@ +import yo from 'yo-yo' + /** * Boilerplate that all Plugins share - and should not be used * directly. It also shows which methods final plugins should implement/override, @@ -16,6 +18,15 @@ export default class Plugin { this.name = this.constructor.name } + update () { + if (typeof this.el === 'undefined') { + return + } + + const newEl = this.render(this.core.state) + yo.update(this.el, newEl) + } + /** * Check if supplied `target` is a `string` or an `object`. * If object (that means its a plugin), search `plugins` for @@ -43,15 +54,11 @@ export default class Plugin { return } - update () { - return - } - install () { return } - run (results) { - return results + run () { + return } } diff --git a/src/plugins/ProgressBar.js b/src/plugins/ProgressBar.js index 200860cfa..0899c6c1d 100644 --- a/src/plugins/ProgressBar.js +++ b/src/plugins/ProgressBar.js @@ -17,15 +17,6 @@ export default class ProgressBar extends Plugin { this.opts = Object.assign({}, defaultOptions, opts) } - update () { - if (typeof this.el === 'undefined') { - return - } - - const newEl = this.render(this.core.state) - yo.update(this.el, newEl) - } - render (state) { const progress = state.totalProgress || 0 diff --git a/src/plugins/ProgressDrawer.js b/src/plugins/ProgressDrawer.js index 6fe98815c..e75adc59d 100644 --- a/src/plugins/ProgressDrawer.js +++ b/src/plugins/ProgressDrawer.js @@ -18,15 +18,6 @@ export default class ProgressDrawer extends Plugin { this.opts = Object.assign({}, defaultOptions, opts) } - update () { - if (typeof this.el === 'undefined') { - return - } - - const newEl = this.render(this.core.state) - yo.update(this.el, newEl) - } - drawerItem (file) { const isUploaded = file.progress === 100 @@ -52,7 +43,7 @@ export default class ProgressDrawer extends Plugin {