How do I make a custom JavaScript dropdown in custom blocks?

Does anyone know how to make a custom JavaScript dropdown for a custom block? The JavaScript function should be based on this script which reports a list of all the cloud variables in the project.

It definitely won't be very easy, because fetching a URL in JavaScript is asynchronous, and menus are not. But you'd do something like this:

function () {
var obj = {};
er='+world.children[0].cloud.username))).forEach(e => {
obj[e] = e;})
return obj;

(Replacing the awaitAsync function with however you would make it synchronous)
Since the process can be delayed by slow internet and such, it's not a very good idea, as if the fetch() function freezes, the project will crash. (Input slots try and calculate their menus instantaneously.)
Of course, this method is untested because of the async problem.

I don't think dropdown menu options allow for Snap! blocks to be put inside of them. pushContext() probably wouldn't work either, because it's not really a process.

There's no way to do it then.

Ok, thanks. I guess I'll skip the dropdown then.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.