|
@@ -1,49 +0,0 @@
|
|
|
-export default class Transloadit {
|
|
|
- constructor(opts) {
|
|
|
-
|
|
|
- this.types = [ 'presetter', 'selecter', 'uploader' ];
|
|
|
-
|
|
|
-
|
|
|
- this.plugins = {};
|
|
|
- }
|
|
|
-
|
|
|
- use(Plugin, opts) {
|
|
|
-
|
|
|
- var plugin = new Plugin(this, opts);
|
|
|
-
|
|
|
-
|
|
|
- if (!this.plugins[plugin.type]) {
|
|
|
- this.plugins[plugin.type] = [];
|
|
|
- }
|
|
|
- this.plugins[plugin.type].push(plugin);
|
|
|
-
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- setProgress(plugin, percentage) {
|
|
|
-
|
|
|
- console.log(plugin.type + ' plugin ' + plugin.name + ' set the progress to ' + percentage);
|
|
|
-
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- run() {
|
|
|
-
|
|
|
- var files = []
|
|
|
- for (var j in this.types) {
|
|
|
- var type = this.types[j];
|
|
|
-
|
|
|
- for (var i in this.plugins[type]) {
|
|
|
- var plugin = this.plugins[type][i];
|
|
|
- console.log('--> Now running ' + plugin.type + ' plugin ' + plugin.name + ': ');
|
|
|
- files = plugin.run(files);
|
|
|
- console.dir(files);
|
|
|
- console.log('');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return files;
|
|
|
- }
|
|
|
-}
|