-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { C } from '@deltachat/jsonrpc-client' | ||
Check failure on line 1 in src/renderer/stores/blobstore.ts GitHub Actions / Code Validation
Check failure on line 1 in src/renderer/stores/blobstore.ts GitHub Actions / Code Validation
|
||
import { selectedAccountId } from '../ScreenController' | ||
|
||
class BlobStore { | ||
private _store: Map<string, Blob> | ||
|
||
constructor() { | ||
this._store = new Map() | ||
} | ||
|
||
load(this: BlobStore, url: string) { | ||
C.getHttpResponse(selectedAccountId(), url).then((response) => { | ||
this._store.set(url, new Blob(btoa(response.blob))) | ||
}); | ||
} | ||
|
||
get(this: BlobStore, url: string) : Blob | null { | ||
let b = this._store.get(url) | ||
return b ? b : null | ||
} | ||
} | ||
|
||
let blobStore = new BlobStore() | ||
|
||
export default blobStore; |