How can I make my own custom snap extensio?

I wonder if I can create a custom extension for snap. I now I could use JavaScript in a custom block but I want to make a real etension. For example Turbowarp that runs scratch projects. I can make a extension for Turbowarp. What about Snap?

If you're talking about using the extension blocks, then it's kind of simple.

First, create the block library, then put the js functions that you used in a js file using this format:

    '[name of function]',
   function([inputs]) {
       // code

For example,

   function(val) {

Of course this is a very simple example, but you get the idea. The function name is what is in the menu. A general format that snap uses to name the functions is [abbreviated library name]_[function](inputs). For example tts_speak(txt, lang, pitch, rate)

Then you also need to host this file on a website, such as github pages (you don't have to host the site, it could be on some file sharing service that allows CORS). Copy the direct url to the file. To load the file, you need to use the primitive function, src_load(url) with the input being the url. Just run that block. If your url is whitelisted, it can be loaded without js on, but if it's not (which is most likely), you need to have js on.
unless you're like me, who created a userscript to whitelist my url
If you're talking about a different kind of extension, then I might be able to tell you how to make it.


hey, im using google drive, but its not working?

that's because you need the direct download link, and you can't get a direct download link for a google drive url, without setting up the api. I'd suggest using something like github pages (especially if other people are going to be using it). And if you can't use github, you could try

none of them work here -_-

do you know of any other CORS file uploaders besides gitlab and notabug?

Nope, unless you host the site, but I don't think you have a server to do that, plus you gotta pay money to get a url.

make your own website (I use replit it's free) and choose html/js/css and just use the url

he uses a school computer and can't access most sites (including replit)

@dlb211183 Did you not read anything I said?

this also works

It works, but what's the point in using that when you can just use the javascript function block?


they probably mean having the js function be the alert function itself, rather than having it be code that creates an extension block that runs the alert function.

i know