also in ES2015 können Sie haben:Aufzählen Wildcard Importe in ES2015
// Module A
export const FOO = 0;
export const BAR = 1;
// Module B
import * as AExports from 'ModuleA';
console.log(AExports.FOO); // Prints 0
Was ist der offizielle Weg, um die Ausfuhr von ModuleA zur Laufzeit aufzuzählen?
import * as AExports from 'ModuleA';
// Are these values guaranteed to be something?
Object.keys(AExports); // If so, should I look at enumerable values?
[...AExports]; // Iterable values?
Object.getOwnPropertyNames(AExports); // Here?
Soweit ich das beurteilen kann, beschreibt die spec dies als ImportedBinding aber ich kann nichts mehr aus, dass ableiten.
NameSpaceImport : * as ImportedBinding
Let localName be the StringValue of ImportedBinding.
Let entry be the Record {[[ModuleRequest]]: module, [[ImportName]]: "*", [[LocalName]]: localName }.
Return a new List containing entry.
Danke auch für die zusätzlichen Links - Sie haben es leichter gemacht, die Spezifikation für das nächste Mal zu verstehen. – AnilRedshift