File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -103,5 +103,21 @@ function. If you're using the `install` package in a CommonJS environment
103
103
like Node, be careful that you don't overwrite the ` require ` function
104
104
provided by that system.
105
105
106
+ If you need to change the behavior of the ` module ` object that each module
107
+ function receives as its third parameter, the shared ` Module ` constructor
108
+ is exposed as a property of the ` install ` function returned by the
109
+ ` makeInstaller ` factory:
110
+
111
+ ``` js
112
+ var install = makeInstaller (options);
113
+ var proto = install .Module .prototype ;
114
+
115
+ // Wrap all Module.prototype.require calls with some sort of logging.
116
+ proto .require = wrapWithLogging (proto .require );
117
+
118
+ // Add a new method available to all modules via module.newMethod(...).
119
+ proto .newMethod = function () {... };
120
+ ```
121
+
106
122
Many more examples of how to use the ` install ` package can be found in the
107
123
[ tests] ( https://github.com/benjamn/install/blob/master/test/run.js ) .
You can’t perform that action at this time.
0 commit comments