- Openclipart API work (waiting on possibility of their adding a missing CORS header)

This commit is contained in:
Brett Zamir
2018-09-26 16:44:56 +08:00
parent ae7d0d1331
commit 9f7f7b9732
20 changed files with 123 additions and 59 deletions

View File

@@ -75,12 +75,26 @@ async function processResults (url) {
e.preventDefault();
const {value: svgURL, id} = this.dataset;
console.log('this', id, svgURL);
/*
const post = (message) => {
// Todo: Make origin customizable as set by opening window
// Todo: If dropping IE9, avoid stringifying
window.parent.postMessage(JSON.stringify({
namespace: 'imagelib',
...message
}), '*');
};
// Send metadata (also indicates file is about to be sent)
post({
name: title,
id: svgURL
});
const result = await fetch(svgURL);
const svg = await result.text();
console.log('svg', svg);
*/
// Todo: Pass to our API
console.log('h', svgURL, svg);
post({
href: svgURL,
data: svg
});
}
}}, [
// If we wanted interactive versions despite security risk: