Skip to content

Commit ba32125

Browse files
committed
emulator.ts remove setBinaryPath & add comments.
1 parent 79753b2 commit ba32125

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

scripts/emulator-testing/emulators/emulator.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ export abstract class Emulator {
4040
this.cacheBinaryPath = path.join(this.cacheDirectory, binaryName);
4141
}
4242

43-
setBinaryPath(path: string) {
44-
this.binaryPath = path;
45-
}
4643
download(): Promise<void> {
4744
if (fs.existsSync(this.cacheBinaryPath)) {
4845
console.log(`Emulator found in cache: ${this.cacheBinaryPath}`);
@@ -58,7 +55,9 @@ export abstract class Emulator {
5855
const writer = fs.createWriteStream(filepath);
5956
console.log(`Downloading emulator from [${this.binaryUrl}] ...`);
6057
// Map the DOM's fetch Reader to node's streaming file system
61-
// operations.
58+
// operations. We will need to access class members `binaryPath` and `copyToCache` after the
59+
// download completes. It's a compilation error to pass `this` into the named function
60+
// `readChunk`, so the download operation is wrapped in a promise that we wait upon.
6261
const downloadPromise = new Promise<void>(
6362
(downloadComplete, downloadFailed) => {
6463
fetch(this.binaryUrl)

0 commit comments

Comments
 (0)