[libpeas] Update peas-demo to use prototypes in its JS examples.



commit a3c86a471332487befd91efa47d9152a2db9054a
Author: Steve Frécinaux <code istique net>
Date:   Mon Apr 11 12:59:48 2011 +0200

    Update peas-demo to use prototypes in its JS examples.

 peas-demo/plugins/gjshello/gjshello.js   |   15 +++++++++------
 peas-demo/plugins/seedhello/seedhello.js |   15 +++++++++------
 2 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/peas-demo/plugins/gjshello/gjshello.js b/peas-demo/plugins/gjshello/gjshello.js
index 5c5ad32..ede389f 100644
--- a/peas-demo/plugins/gjshello/gjshello.js
+++ b/peas-demo/plugins/gjshello/gjshello.js
@@ -5,20 +5,23 @@ var LABEL_STRING = "GJS Also Says Hello!";
 print("LABEL_STRING=" +  LABEL_STRING);
 
 function activatable_extension() {
-  this.activate = function() {
+}
+
+activatable_extension.prototype = {
+  activate: function() {
     print("GJSHelloPlugin.activate");
     this.object._gjshello_label = new Gtk.Label({ label: LABEL_STRING });
     this.object._gjshello_label.show();
     this.object.get_child().add(this.object._gjshello_label);
-  };
-  this.deactivate = function() {
+  },
+  deactivate: function() {
     print("GJSHelloPlugin.deactivate");
     this.object.get_child().remove(this.object._gjshello_label);
     this.object._gjshello_label.destroy();
-  };
-  this.update_state = function() {
+  },
+  update_state: function() {
     print("GJSHelloPlugin.update_state");
-  };
+  }
 };
 
 function configurable_extension() {
diff --git a/peas-demo/plugins/seedhello/seedhello.js b/peas-demo/plugins/seedhello/seedhello.js
index a06d914..b95578e 100644
--- a/peas-demo/plugins/seedhello/seedhello.js
+++ b/peas-demo/plugins/seedhello/seedhello.js
@@ -26,20 +26,23 @@ var LABEL_STRING = "Seed Says Hello Too!";
 print("LABEL_STRING=" +  LABEL_STRING);
 
 function activatable_extension() {
-  this.activate = function() {
+}
+
+activatable_extension.prototype = {
+  activate: function() {
     print("SeedHelloPlugin.activate");
     this.object._seedhello_label = new Gtk.Label({ label: LABEL_STRING });
     this.object._seedhello_label.show();
     this.object.get_child().pack_start(this.object._seedhello_label);
-  };
-  this.deactivate = function() {
+  },
+  deactivate: function() {
     print("SeedHelloPlugin.deactivate");
     this.object.get_child().remove(this.object._seedhello_label);
     this.object._seedhello_label.destroy();
-  };
-  this.update_state = function() {
+  },
+  update_state: function() {
     print("SeedHelloPlugin.update_state");
-  };
+  }
 };
 
 function configurable_extension() {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]