How do I add new blocks to the Snap code?

Hi, I'm making a Snap! mod, and I would like to know wheres the code (like the JS) for each of the blocks are?

Objects,js

I thought thats where the name and inputs for the blocks are? But where is the JS definition for all of them?

Some are in threads js and some other are in sprites js

Can you show me where in each of these files are the definitions located?

[offtopic]
Also did you ever figure out who found your password in a leak?
[/offtopic]

I did cuz that guy PMed me in replit
probably not programmer_user lol

Don't you have a text editor with a search feature? If you find the palette entry in objects.js then you know what the procedure is called.

huh? I mean where the actual JavaScript code for each of these blocks are located. Also im hosting it on my website and editing it with github.dev

we can't point at your screen. you need to actually start reading the file or searching it.
pretty much every text editor can search with ctrl-f.

Yes I understand. So, let's say you want to know about FOR EACH ITEM. First you search for FOR EACH in objects.js and you find

        doForEach: {
            type: 'command',
            category: 'lists',
            spec: 'for each %upvar in %l %cla',
            defaults: [localize('item')]
        },

So now you know that the procedure you're looking for is named doForEach. So now you search through all the source files for that. I'm a Unix guy so I do it this way:

Brians-MBP.Home% grep doForEach *.js
objects.js:        doForEach: {
objects.js:    doRepeat: ['doUntil', ['doForever', -1], ['doFor', 2], ['doForEach', 1]],
objects.js:        ['doForEach', 1]],
objects.js:        ['doForEach', 2]],
objects.js:        ['doForEach', -1]],
objects.js:    doForEach: [['doFor', 1], ['doForever', -2], ['doRepeat', -1],
objects.js:        blocks.push(block('doForEach'));
objects.js:        blocks.push(block('doForEach'));
threads.js:Process.prototype.doForEach = function (upvar, list, script) {

which is more than you would have liked, because FOR EACH is relabelable, but only one of those lines looks like the beginning of a procedure definition, namely the last one

threads.js:Process.prototype.doForEach = function (upvar, list, script) {

So that tells you the code you're looking for is in threads.js.

I just look in threads.js for Process.prototype.<selector name>.

But not all primitives are there! Some are in lists.js, some are in morphic.js, etc.

Give me an example of one in morphic.js, then.

Okay, not morphic. But maps.js and objects.js have primitives.

ok i actually had to try and understand the code and now its easier for me. Thanks!

What is this mod and where can I find it? (I'm curious)

its unfinished, and incredibly buggy, and only adds one blocks.

owlfiles.netlify.app/expsnap

wheres the github?

TheOwlCoder/fileholder/expsnap

i cant edit because the school internet blocks github and github.dev (and netlify websites)