Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Ivan Kopeykin @vankop
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | const ModuleFactory = require("./ModuleFactory");
|
---|
9 |
|
---|
10 | /** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
|
---|
11 | /** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
|
---|
12 | /** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Ignores error when module is unresolved
|
---|
16 | */
|
---|
17 | class IgnoreErrorModuleFactory extends ModuleFactory {
|
---|
18 | /**
|
---|
19 | * @param {NormalModuleFactory} normalModuleFactory normalModuleFactory instance
|
---|
20 | */
|
---|
21 | constructor(normalModuleFactory) {
|
---|
22 | super();
|
---|
23 |
|
---|
24 | this.normalModuleFactory = normalModuleFactory;
|
---|
25 | }
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * @param {ModuleFactoryCreateData} data data object
|
---|
29 | * @param {function(Error=, ModuleFactoryResult=): void} callback callback
|
---|
30 | * @returns {void}
|
---|
31 | */
|
---|
32 | create(data, callback) {
|
---|
33 | this.normalModuleFactory.create(data, (err, result) => {
|
---|
34 | return callback(null, result);
|
---|
35 | });
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | module.exports = IgnoreErrorModuleFactory;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.