Please add honeyhomes.retool.com
Thank you!
@Erin_Masatsugu Hello Erin, haved considered to add async function
?
thanks. My use case is to fetch image go get file size via HEAD
request.
Hi Erin,
We would love to join the alpha.
Could you please provide access to austspacovers.retool.com
Thank you!
-Jamie
+1 although I'm mostly curious if sync
will always be the default or if there are plans to add a sync/async
option and the default behavior could change.
for your use case, hope you don't mind me asking if you've tried using XMLHttpRequest
most browsers on desktop/mobile should have built-in access to XMLHttpRequest which lets you make sync HEAD
requests. if you haven't used it before you can put the following code in the Preloaded JS area:
window.urlExists = async function(url, onError, onSuccess){
var xhr = new XMLHttpRequest();
// 3rd parameter of .open() is to enable/disable async
// HEAD is the same as GET but with no request body, you could try using it still but it might depend on the server if it works or not
xhr.open('HEAD' /*'GET'*/, url, false);
xhr.setRequestHeader('Content-Type', 'application/json');
try{
// sync causes .send() to block
xhr.send();
if(xhr.status != 200){
// console.log(xhr.status, xhr.statusText);
// retool resource requests still return a promise, so we want to await to keep it sync
await onError(xhr.status, xhr.statusText) ;
}
else{
// console.log(xhr.status, xhr.response);
await onSuccess(xhr.status, xhr.response);
}
}
catch(err){
// console.log("Request Failed");
await onError(xhr.status?? 500, "Request Failed");
}
}
you could also make a JS Code resource with the same name and function content, either way you would use it basically the same (await urlExists.trigger()
or await urlExists.trigger({"additionalScope": {"url": my_url})
if you use the additional scope vs below picture). add an Event Handler to whatever action you want to trigger it, choose Run Script and call function with await
you could also call it in other places with {{ await window.urlExists('my_url') }}
if you have any questions feel free to send me a dm so we don't hijack the thread on accident
Yes we are considering adding async functions! We don't have the details yet, but we aren't planning to make async functions the default.
Hi @Erin_Masatsugu please add sync functions to throwbo.retool.com, thank you!
Having a way to add simple helper functions for formatting ephemeral values would be very helpful.
Hi Erin!
can trapezoidtech.retool.com
sign up as well please?
Hi Erin! @Erin_Masatsugu could you please add these sync functions to kredito.retool.com. Thank you!
Hello @Erin_Masatsugu ! This feature is exactly what we are looking for! Can you please enable this feature for https://teamgarden.retool.com ?
For anyone else encountering issues with sync functions, I think I have figured part of the reason why.