File tree
Expand file treeCollapse file tree4 files changed
+8
-11
lines changed Expand file treeCollapse file tree4 files changed
+8
-11
lines changed Original file line number | Diff line number | Diff line change |
---|
|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 |
| -// global.api = {}; |
4 | 3 | const api = {};
|
5 | 4 | api.fs = require('fs');
|
6 | 5 | api.vm = require('vm');
|
7 | 6 | api.timers = require('timers');
|
8 | 7 |
|
9 |
| -// global.application = {}; |
10 | 8 | const application = {};
|
11 | 9 | application.unit1 = require('./lib/unit1');
|
12 | 10 | application.unit2 = require('./lib/unit2');
|
13 | 11 | require('./lib/unit3')(api, application);
|
14 | 12 |
|
15 |
| -application.reloadUnit = name => { |
| 13 | +application.reloadUnit = (name) => { |
16 | 14 | const moduleKey = require.resolve('./lib/' + name);
|
17 | 15 | delete require.cache[moduleKey];
|
18 | 16 | require('./lib/' + name)(api, application);
|
|
Original file line number | Diff line number | Diff line change |
---|
|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 |
| -module.exports = (api, metasync) => { |
4 |
| - |
| 3 | +module.exports = (api, application) => { |
5 | 4 | const FILE_SCOPE_CONSTANT = 100;
|
6 |
| -metasync.MODULE_SCOPE_CONSTANT = 200; |
| 5 | +application.APPLICATION_SCOPE_CONSTANT = 200; |
7 | 6 | api.metasync.EXPORTED_CONSTANT = 300;
|
8 | 7 |
|
9 | 8 | const fileScopeFunction = () => {};
|
10 |
| -metasync.moduleScopeFunction = () => {}; |
| 9 | +application.applicationScopeFunction = () => {}; |
11 | 10 | api.metasync.exportedFunction = () => {};
|
12 | 11 |
|
| 12 | +console.log({ |
| 13 | +FILE_SCOPE_CONSTANT, |
| 14 | +fileScopeFunction, |
| 15 | +}); |
13 | 16 | };
|
Original file line number | Diff line number | Diff line change |
---|
|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 | 3 | module.exports = {
|
4 |
| - |
5 | 4 | showPaths() {
|
6 | 5 | console.dir({
|
7 | 6 | __dirname,
|
@@ -13,5 +12,4 @@ module.exports = {
|
13 | 12 | doSomething() {
|
14 | 13 | console.log('Somenting done');
|
15 | 14 | }
|
16 |
| - |
17 | 15 | };
|
Original file line number | Diff line number | Diff line change |
---|
@@ -5,7 +5,6 @@ const LOCAL_CONSTANT = 'local value';
|
5 | 5 | const EXPORTED_CONSTANT = 'exported value';
|
6 | 6 |
|
7 | 7 | module.exports = (api, application) => {
|
8 |
| - |
9 | 8 | application.unit3 = unit3;
|
10 | 9 | unit3.EXPORTED_CONSTANT = EXPORTED_CONSTANT;
|
11 | 10 |
|
@@ -20,5 +19,4 @@ module.exports = (api, application) => {
|
20 | 19 |
|
21 | 20 | unit3.doSomethingSpecial = () => {
|
22 | 21 | };
|
23 |
| - |
24 | 22 | };
|
You can’t perform that action at this time.
0 commit comments