Skip to content

Commit ccfd5a8

Browse files
chicoxyzzyTheLarkInn
authored andcommitted
refactor(es6): Upgrade AbstractPlugin to es6 (webpack#3669)
1 parent bc74372 commit ccfd5a8

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

lib/AbstractPlugin.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,26 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
function AbstractPlugin(plugins) {
6-
this._plugins = plugins || {};
7-
}
8-
module.exports = AbstractPlugin;
5+
"use strict";
6+
7+
class AbstractPlugin {
8+
static create(plugins) {
9+
return class Plugin extends AbstractPlugin {
10+
constructor() {
11+
super(plugins);
12+
}
13+
};
14+
}
915

10-
AbstractPlugin.create = function(plugins) {
11-
function Plugin() {
12-
AbstractPlugin.call(this, plugins);
16+
constructor(plugins) {
17+
this._plugins = plugins || {};
1318
}
14-
Plugin.prototype = Object.create(AbstractPlugin.prototype);
15-
return Plugin;
16-
};
1719

18-
AbstractPlugin.prototype.apply = function(object) {
19-
for(var name in this._plugins) {
20-
object.plugin(name, this._plugins[name]);
20+
apply(object) {
21+
for(const name in this._plugins) {
22+
object.plugin(name, this._plugins[name]);
23+
}
2124
}
22-
};
25+
}
26+
27+
module.exports = AbstractPlugin;

0 commit comments

Comments
 (0)