This repository has been archived by the owner on Jun 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webpack): now it is compatible with
webpack 2
- Loading branch information
Showing
3 changed files
with
75 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @private | ||
* @type {WeakMap} | ||
*/ | ||
const COMMAND = new WeakMap(); | ||
|
||
/** | ||
* @class | ||
*/ | ||
class ConfigCommandInvoker { | ||
/** | ||
* @constructor | ||
* @param {ConfigCommand} command | ||
*/ | ||
constructor(command) { | ||
COMMAND.set(this, command); | ||
} | ||
|
||
/** | ||
* @readonly | ||
* @type {ConfigCommand} | ||
*/ | ||
get command() { | ||
return COMMAND.get(this); | ||
} | ||
|
||
/** | ||
* @param {Config} config | ||
* @param {...*} values | ||
* @returns {Config} | ||
*/ | ||
invoke(config, ...values) { | ||
for (const value of values) { | ||
this.command.execute(config, value); | ||
} | ||
|
||
return config; | ||
} | ||
} | ||
|
||
export default ConfigCommandInvoker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters