You Got A Question? Ask    GNOME Community!

gtk-theme2
 10722   |  Oct 25
gtk_logo2
 9352   |  Mar 17
arch
 7472   |  Mar 28

Gnome Docs | Extensions: Step by step tutorial

This post was made with an older stylesheet

I will skip the details because Carlos explain everything on Step by step tutorial to create extensions @ Gnome Live! Just a small note, on Gameosx.js file, Carlos has made a small error, you have to remove line 295 “};”.

I didn’t try the extension demos, but the just the Clutter   ..plus I added some GTK.


Song: Old Remedy | butterfly

You will find the GTK + Javascript samples at:
http://developer.gnome.org/gnome-devel-demos/unstable/beginner.js.html.en

It will be very typical of me to talk again about the advantages of JavaScript + Gnome, so I won’t. But a small tip, if you can avoid GTK for your App (ie a game), then avoid it and write it up completely in Clutter.

JavaScript Patterns

This is the absolute tutorial to learn write JavaScript the “right” way. It introduces the best practices for every problem, and while it targets mostly in Web Development it is also perfect if you want to get it started with Gnome Development.

All the tutorials are written in a very simple way, so even if this is the first time you see a programming language in your life, you won’t have any problem to get into it.

Functions Declaration

/* 
Description: creating anonymous functions and assigning them to a variable
*/

// antipattern
function getData() {
}

// preferred /* Benefits: * 1. Makes it easier to understand "functions as an object". * 2. It enforces good semicolon habits. * 3. Doesn't have much of the baggage traditionally associated with functions and scope. */ var getData = function () { };
// named function expression /* Benefits: * 1. Provides the debugger with an explicit function name: helps stack inspection. * 2. Allows recursive functions: getData can call itself. * Issues: * 1. there are historic quirks with IE */ var getData = function getData () { };

This is just an example, all the patterns are like these simply explained. Of course the guide goes into the most advanced structures. If you are interested give it a look.

JavaScript Patterns 


 
  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • Carlos Soriano Sánchez

    Hi Alex,

    Thank you for take into account my work!
    Apart of this, I have to say that the tutorial is still not finished (that’s why there’s still not a direct link in gnome wiki) and I’m a little beginner too, so sure there some little errors. I hope that some developer “correct” the bad things of the tutorial and finally we can have some good and well explained documentation for total beginners.
    Also, I will correct the error in the game. ;)
    There’s a git repository with all the code’s and wiki code https://github.com/seiryu89/StepByStepTutorial , so I appreciate if anyone wants to help to do the tutorial =)

    See you

    • alex285

      I hope to see your tutorial in developer.gnome.org soon!

      • Carlos Soriano Sánchez

        hmm… I think this is not possible…developer.gnome.org is maintained by the developers, and the wiki from community people. And I guess that gnome developers are very strict for this, and documents from wiki can’t go as is to developer.gnome (if some document go to developer.gnome developers has to see if all detail is correct, well explained, good English, etc. and since then it has to be maintained by them).
        But well, gnome wiki is a good place =)

    • foobar

      Awesome work! Thank you for doing this.

    • Rajesh KSV

      Hey the above Github link is not working. should it be https://github.com/csoriano89/StepByStepTutorial ?