Examples of userscripts that use the modern SDK?

So far, in my quest to learn how to develop userscripts, I’ve been told of a few websites that have examples of userscripts/macros (listed below). In addition, there are some example scripts included in the Komodo IDE installation, at AppData\Local\ActiveState\KomodoIDE\10.2\tools (for Windows users). But all of them (with the exception of this article), seem to use the legacy ko.* approach. Are there any examples of userscripts that use the modern require( ‘ko/*’ ) approach?

1 Like

There won’t be anything modern in these sites.

I think your best bet is to post the problems/ideas in the How To section of the forums:


We’re very responsive as you have noticed. Then we can get the community resource (exactly what you’re looking for) built up for the modern SDK we have now.

Another option would be to search the Komodo Edit code base for examples or require('ko/blah'). Anything that the source can do can usually be done in a Userscript as well.

  • Carey

I appreciate those suggestions, as well as the responsiveness and patience from you and the other contributors!

In order to reduce the amount of code that one would need to search through each time, do you think it would be sufficient to limit the search to the code contained in https://github.com/Komodo/KomodoEdit/tree/master/src/chrome/komodo/content/sdk, or should one look at a superset, such as https://github.com/Komodo/KomodoEdit/tree/master/src/ ?

@mjross, I don’t really know exactly what you’re looking for. Are you looking for the SDK source? Or examples of it being used? I thought it was the latter.

For the former you can look in:

Most new Modules/extensions have a require module in them as well:

You should be able to search for module.exports in that code for which modules have SDKs.

For examples use the search tool to find places where the SDK you want to use are. eg. require('ko/views').

There is always the docs which granted are not complete but still quite robust:

You will also note that at the bottom of that page is a reference to the Mozilla CommonJS SDK as well. Since we are built on Mozilla we have full access to that as well:

This could be a little overwhelming. I really suggest coming up with ideas, evaluating what you need as per an SDK then find that tool. If you need help with it, open a new Forum thread and we or someone from the community will help you pretty quickly.

  • Carey

Thank you for all of that information. To answer your two questions: I was initially asking as to where I could find examples of userscripts that utilize the modern techniques that we should be using, but when you indicated that there really aren’t any and I could look at the source code, then I asked about which code I should look at. Anyway, you’ve given me lots to work with here, so I’m good for now, and will likely come up with some specific questions later.

You can look at Xemmet. It uses the modern SDK in most cases :slight_smile:

1 Like

Excellent. Thanks!