Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Developing GNOME Apps in Javascript

1,160 views

Published on

Published in: Software, Technology
  • Be the first to comment

Developing GNOME Apps in Javascript

  1. 1. Developing GNOME Apps in Javascript Felipe Borges <felipeborges@gnome.org>
  2. 2. Why talk about Gjs?
  3. 3. GNOME is.... Desktop environment Development platform
  4. 4. GNOME Developer Platform
  5. 5. Javascript is pretty cool!
  6. 6. It has bad parts! Globals Unexpected behaviour No block scope
  7. 7. But it also has good parts! Closures are central Functions are first-class objects Prototypal inheritance Is everywhere!
  8. 8. Gjs First released in 2008 Well maintained Main development language for writing GNOME Apps
  9. 9. GNOME Apps in JS Documents Shell Polari
  10. 10. gjs-console
  11. 11. Get started Gjs and Gtk Actions and signals Run your application
  12. 12. const Lang = imports.lang; const Gtk = imports.gi.Gtk; const App = new Lang.Class({ Name: 'App', Extends: Gtk.Application, _init: function () { this.parent({ application_id: 'org.example.App' }); this.connect('activate', Lang.bind(this, this._onActivate)); this.connect('startup', Lang.bind(this, this._onStartup)); },
  13. 13. _onActivate: function () { this._window.show_all(); }, _onStartup: function () { this._window = new Gtk.ApplicationWindow({ application: this, title: "Hello World!" }); this._window.set_default_size(200, 200); let label = new Gtk.Label({ label: "Hello World" }); this._window.add(label); } });
  14. 14. Run your application let app = new App(); app.run(ARGV); $ gjs helloWorld.js
  15. 15. http://developer.gnome.org/
  16. 16. Become a Friend of GNOME Individual donation program Donations support the GNOME project http://gnome.org/friends
  17. 17. Developing GNOME Apps in Javascript Felipe Borges <felipeborges@gnome.org>

×