Skip to content

Commit d174c35

Browse files
committed
wip
1 parent 749e24d commit d174c35

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

ghcjs/miso-functora/js/main.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ export async function insertStorage(key, value) {
3030

3131
export async function selectClipboard() {
3232
const { value } = await Clipboard.read();
33-
return value;
33+
try {
34+
return newBlobUrl(value);
35+
} catch (e) {
36+
return value;
37+
}
3438
}
3539

3640
export async function openBrowserPage(url) {
@@ -103,4 +107,17 @@ export function newBlobUrl(value) {
103107
return URL.createObjectURL(blob);
104108
}
105109

110+
export async function fetchUrlAsRfc2397(url) {
111+
const resp = await fetch(url);
112+
const blob = await resp.blob();
113+
return new Promise((resolve, reject) => {
114+
var fr = new FileReader();
115+
fr.onload = () => {
116+
resolve(fr.result);
117+
};
118+
fr.onerror = reject;
119+
fr.readAsDataURL(blob);
120+
});
121+
}
122+
106123
defineCustomElements(window);

ghcjs/miso-functora/js/main.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)