Skip to content

Commit

Permalink
avoid recreating decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
F001 committed Dec 12, 2018
1 parent 447e90b commit 9d526eb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/os.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ export function codeFetch(specifier: string, referrer: string): CodeInfo {
const sourceCode = codeFetchRes.sourceCodeArray() || undefined;
const outputCode = codeFetchRes.outputCodeArray() || undefined;
const sourceMap = codeFetchRes.sourceMapArray() || undefined;
const decoder = new TextDecoder();
return {
moduleName: codeFetchRes.moduleName() || undefined,
filename: codeFetchRes.filename() || undefined,
mediaType: codeFetchRes.mediaType(),
sourceCode: sourceCode && new TextDecoder().decode(sourceCode),
outputCode: outputCode && new TextDecoder().decode(outputCode),
sourceMap: sourceMap && new TextDecoder().decode(sourceMap)
sourceCode: sourceCode && decoder.decode(sourceCode),
outputCode: outputCode && decoder.decode(outputCode),
sourceMap: sourceMap && decoder.decode(sourceMap)
};
}

Expand Down

0 comments on commit 9d526eb

Please sign in to comment.