Última atividade 1732918174

fetch-for-alfred.js Bruto
1function fetch(url, useJson = true) {
2 const queryURL = $.NSURL.URLWithString(url);
3 const requestData = $.NSData.dataWithContentsOfURL(queryURL);
4 const requestString = $.NSString.alloc.initWithDataEncoding(
5 requestData,
6 $.NSUTF8StringEncoding,
7 ).js;
8 if (useJson) {
9 return JSON.parse(requestString);
10 } else {
11 return requestString;
12 }
13}
14
15console.log(fetch("https://melaniekat.com/gifs/api"))
16