0

try to send a signal from a object to another in a gtk app that use a javascript language.

const pippo = new Lang.Class({
Name: "test.pippo",

_init: function () {
    Log('test init');

    this._start();
},

_start: function () {
    Log('signal emit');

    this.emit("pippo-start");

}
});

Signals.addSignalMethods(pippo.prototype);

this is the method i use to create and binding signal:

var tmp =new Util.pippo();
tmp.connect('pippo-start', Lang.bind(this, function () {
  Log('event receive!!!');
}));

in the log i see the signal just emited but never recieved by the function is listening; any advice? or documention for this topic in javascript? thx

1 Answers1

0

Seems that all you have here is Object.prototype. Declare you class in a way that defines the prototype:

function pippo() {
    this._init.apply(this, arguments);
}

/*
* 
*/
pippo.prototype = {
    _init: function () {
        Log('test init');

        this._start();
    },

    _start: function () {
        Log('signal emit');

        this.emit("pippo-start");
    }
}
Barton
  • 547
  • 5
  • 11