Skip to content

Commit

Permalink
Merge branch 'migrate-to-typescript'
Browse files Browse the repository at this point in the history
This migrates the entire library to strict TypeScript, mostly using the
default TypeScript settings generated by `tsc --init`.

Several mistakes were caught and fixed in the migration. In particular,
aditional checks were added for undefined and null to improve
robustness.

Suggested-by: Arden Sinclair <general@ardensinclair.com> (#1)
  • Loading branch information
kdrag0n committed Apr 30, 2021
2 parents 334e089 + e7ef5dc commit 43e29c9
Show file tree
Hide file tree
Showing 20 changed files with 12,857 additions and 2,757 deletions.
12 changes: 5 additions & 7 deletions demo/download.js
@@ -1,5 +1,3 @@
import * as common from "../lib/common.js";

const DB_NAME = "BlobStore";
const DB_VERSION = 1;

Expand Down Expand Up @@ -65,20 +63,20 @@ export class BlobStore {
* Downloads the file from the given URL and saves it to this BlobStore.
*
* @param {string} url - URL of the file to download.
* @returns {blob} Blob containing the downloaded data.
* @returns {Promise<Blob>} Blob containing the downloaded data.
*/
async download(url) {
let filename = url.split("/").pop();
let blob = await this.loadFile(filename);
if (blob === null) {
common.logDebug(`Downloading ${url}`);
console.log(`Downloading ${url}`);
let resp = await fetch(new Request(url));
blob = await resp.blob();
common.logDebug("File downloaded, saving...");
console.log("File downloaded, saving...");
await this.saveFile(filename, blob);
common.logDebug("File saved");
console.log("File saved");
} else {
common.logDebug(
console.log(
`Loaded ${filename} from blob store, skipping download`
);
}
Expand Down
1 change: 1 addition & 0 deletions demo/ui.js
Expand Up @@ -4,6 +4,7 @@ import * as fastboot from "../dist/fastboot.mjs";
import { BlobStore } from "./download.js";

let device = new fastboot.FastbootDevice();
window.device = device;
let blobStore = new BlobStore();

// Enable verbose debug logging
Expand Down

0 comments on commit 43e29c9

Please sign in to comment.