[libpeas] Seed, GJS: Use proper prototypes for JS extensions.



commit 3e573f833f80545ccbbef92ab3b4227d619ecabb
Author: Steve Frécinaux <code istique net>
Date:   Mon Apr 11 10:15:52 2011 +0200

    Seed, GJS: Use proper prototypes for JS extensions.

 .../libpeas/plugins/extension-gjs/extension-gjs.js |   17 ++++++++++-------
 .../plugins/extension-seed/extension-seed.js       |   19 +++++++++++--------
 2 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/tests/libpeas/plugins/extension-gjs/extension-gjs.js b/tests/libpeas/plugins/extension-gjs/extension-gjs.js
index 94b432d..d855f50 100644
--- a/tests/libpeas/plugins/extension-gjs/extension-gjs.js
+++ b/tests/libpeas/plugins/extension-gjs/extension-gjs.js
@@ -1,13 +1,16 @@
 function callable_extension() {
-  this.call_with_return = function() {
+}
+
+callable_extension.prototype = {
+  call_with_return: function() {
     return "Hello, World!"
-  };
-  this.call_no_args = function() {
-  };
-  this.call_single_arg = function() {
+  },
+  call_no_args: function() {
+  },
+  call_single_arg: function() {
     return true
-  };
-  this.call_multi_args = function() {
+  },
+  call_multi_args: function() {
     return [ true, true, true ]
   }
 };
diff --git a/tests/libpeas/plugins/extension-seed/extension-seed.js b/tests/libpeas/plugins/extension-seed/extension-seed.js
index 876b4d8..2d60323 100644
--- a/tests/libpeas/plugins/extension-seed/extension-seed.js
+++ b/tests/libpeas/plugins/extension-seed/extension-seed.js
@@ -1,15 +1,18 @@
 function callable_extension() {
-  this.call_with_return = function() {
+}
+
+callable_extension.prototype = {
+  call_with_return: function() {
     return "Hello, World!"
-  };
-  this.call_no_args = function() {
-  };
-  this.call_single_arg = function() {
+  },
+  call_no_args: function() {
+  },
+  call_single_arg: function() {
     return true
-  };
-  this.call_multi_args = function() {
+  },
+  call_multi_args: function() {
     return [ true, true, true ]
-  };
+  }
 };
 
 function properties_extension() {



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