Add a block that checks if Javascript on a project is enabled

And maybe a enable/disable Javascript block.

Well, it actually is currently possible like this

Although, if the option became a primitive, it would be put into this block

A better definition would be:

Yes please!!!

You're right, that is better. It doesn't rely on yeilds.

The whole point of disabling JS by default is for security reasons. If you could just enable it using a block, now that wouldn't be very secure, would it?
Also, what use would a disable JS block have?

dang I was too late :frowning:
I did the exact same thing but the error catching blocks.

I tried this to see if it actually worked, but it gave me an error inside the block, and just running the script will give you the error for a second.

If it's in a launch block, it will give an error if you're in presentation mode (full screen), but it shouldn't if you're in the editor. Plus, the way with the error catching library is way better.

That's why I used it.
Although, reporter blocks don't work in command blocks :frowning: .
So we can't make a block say to turn on js to use it.

Well, actually you can. All you need to do is use an if/else statement that checks if js is on, and if it's off, make it tell you to turn on js, although, if you try to run a js function with js off, snap says

yeah but we can't make the command block report stuff.
Edit actually, make one of these blocks
and do this
then you can get this error
But if you want an error, just use the error primative block.

You're right, we can't make a commend report. It used to be possible by sticking the command block in a call block, but I guess that was patched. I do think the best option is just to use the error block, or just run the javascript function, and let that throw the error. Plus, with the js function throwing an error, it'll show the function, so you can read it to make sure it's safe, although that would only work in the editor.

But if you want it to tell you to turn on js, you can't js to make the msg.

@bh please let us use report block in command block in a later update.

It'll say that js extensions are off...

That's never gonna happen because a command block is supposed to run a commend, a reporter is supposed to report.

Look, this whole thing is a nice idea. But I don't think you can use JS functions without having JS on in the first place. Sorry if i'm wrong, I'm kinda dumb. There might be some workaround we can figure out, like maybe a pop-up box. Warning of the risks of turning on JS functions. Then if they click yes, it enables JS functions, without having to go into the project editor.

It was removed because somebody hacked snap with it, I don't know the exact details, but no, they will never be added.


If you use the “error” extension you can detect JS without using JS, instead it uses primitives.