fix: output console.logs as user types (DOM)

Any console.logs inside script tags will be written to the fcc console
as the user types.  DOM challenges only.

Also, DRYed out the main and test frame creation.
This commit is contained in:
Oliver Eyton-Williams
2019-11-01 13:02:23 +01:00
committed by mrugesh
parent 6acab90cb6
commit 29641986ab
3 changed files with 37 additions and 21 deletions

View File

@@ -159,10 +159,13 @@ export function buildBackendChallenge({ url }) {
};
}
export function updatePreview(buildData, document) {
export async function updatePreview(buildData, document, proxyLogger) {
const { challengeType } = buildData;
if (challengeType === challengeTypes.html) {
createMainFramer(document)(buildData);
await new Promise(resolve =>
createMainFramer(document, resolve, proxyLogger)(buildData)
);
} else {
throw new Error(`Cannot show preview for challenge type ${challengeType}`);
}