main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
432 bytes
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | Import a module while bypassing the cache.
|
---|
| 3 |
|
---|
| 4 | @example
|
---|
| 5 | ```
|
---|
| 6 | // foo.js
|
---|
| 7 | let i = 0;
|
---|
| 8 | module.exports = () => ++i;
|
---|
| 9 |
|
---|
| 10 | // index.js
|
---|
| 11 | import importFresh = require('import-fresh');
|
---|
| 12 |
|
---|
| 13 | require('./foo')();
|
---|
| 14 | //=> 1
|
---|
| 15 |
|
---|
| 16 | require('./foo')();
|
---|
| 17 | //=> 2
|
---|
| 18 |
|
---|
| 19 | importFresh('./foo')();
|
---|
| 20 | //=> 1
|
---|
| 21 |
|
---|
| 22 | importFresh('./foo')();
|
---|
| 23 | //=> 1
|
---|
| 24 |
|
---|
| 25 | const foo = importFresh<typeof import('./foo')>('./foo');
|
---|
| 26 | ```
|
---|
| 27 | */
|
---|
| 28 | declare function importFresh<T>(moduleId: string): T;
|
---|
| 29 |
|
---|
| 30 | export = importFresh;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.