[gjs] dbus: add makeProxyClass()



commit ac7475244dbdb2e4042ca7c03b71fd307f83db0a
Author: Dan Winship <danw gnome org>
Date:   Thu Feb 25 10:17:41 2010 -0500

    dbus: add makeProxyClass()
    
    This lets you easily make a proxy class, given an interface struct
    
    https://bugzilla.gnome.org/show_bug.cgi?id=610859

 modules/dbus.js |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/modules/dbus.js b/modules/dbus.js
index cd6d94b..4198d4c 100644
--- a/modules/dbus.js
+++ b/modules/dbus.js
@@ -594,17 +594,16 @@ DBusError.prototype = {
     }
 };
 
-// Introspectable proxy
-function IntrospectableProxy(bus, busName, path) {
-    this._init(bus, busName, path);
-}
+// Creates a proxy class for a given interface
+function makeProxyClass(iface) {
+    let constructor = function() { this._init.apply(this, arguments); };
 
-IntrospectableProxy.prototype = {
-    _init : function(bus, busName, path) {
-        bus.proxifyObject(this, busName, path);
-    }
+    constructor.prototype._init = function(bus, name, path) {
+        bus.proxifyObject(this, name, path);
+    };
 
-};
+    proxifyPrototype(constructor.prototype, iface);
+    return constructor;
+}
 
-proxifyPrototype(IntrospectableProxy.prototype,
-                 Introspectable);
+var IntrospectableProxy = makeProxyClass(Introspectable);



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