Il giorno mar, 14/06/2011 alle 19.22 +1000, Tim Cuthbertson ha scritto: > So it seems that all GObjects have an `emit` method for signals. > > I have need in my extension for one javascript object to be notified > of an event happening in another object. Both of these are plain old > javascript objects. What do I need to call / inherit from in order to > emit and connect to signals on a javascript object? > > I have tried setting my __proto__ to GObject.Object.prototype, but > when I call `emit` I get the following error: > > Error: Object 0x7f246888a8f0 proto 0x7f246888a820 doesn't have a dynamically-registered class, it has Object Currently, you cannot inherit from GObject, so that won't work. You need to use the Signals module (imports.signals), with Signals.addSignalMethods(MyObject.prototype). Then you can use connect, disconnect, emit as you like (no signal registration is needed) Giovanni
Attachment:
signature.asc
Description: This is a digitally signed message part