Developing GNOME Apps in Javascript

1,032 views

Published on

Published in: Software, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,032
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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>

×