main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[79a0317] | 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 | null)=, ModuleFactoryResult=): void} callback callback
|
---|
| 30 | * @returns {void}
|
---|
| 31 | */
|
---|
| 32 | create(data, callback) {
|
---|
| 33 | this.normalModuleFactory.create(data, (err, result) =>
|
---|
| 34 | callback(null, result)
|
---|
| 35 | );
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | module.exports = IgnoreErrorModuleFactory;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.