Skip to content

Commit d7e7df8

Browse files
committed
Mention makeInstaller(options).Module in README.md.
1 parent 561c21a commit d7e7df8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,21 @@ function. If you're using the `install` package in a CommonJS environment
103103
like Node, be careful that you don't overwrite the `require` function
104104
provided by that system.
105105

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+
106122
Many more examples of how to use the `install` package can be found in the
107123
[tests](https://github.com/benjamn/install/blob/master/test/run.js).

0 commit comments

Comments
 (0)