Files
w4rpservices/node_modules/laravel-mix/src/components/Extend.js
2018-10-27 03:51:47 -05:00

32 lines
692 B
JavaScript
Vendored

let ComponentFactory = require('./ComponentFactory');
class Extend {
/**
* Register the component.
*
* @param {string} name
* @param {Component} component
*/
register(name, component) {
if (typeof component !== 'function') {
component.name = () => name;
return new ComponentFactory().install(component);
}
new ComponentFactory().install({
name: () => name,
register(...args) {
this.args = args;
},
webpackConfig(config) {
component.call(this, config, ...this.args);
}
});
}
}
module.exports = Extend;