Here is my JavaScript code.:
//Events to watch
CanvasIO.events = [
    "object:added",
    "object:removed",
    "object:modified",
    "object:rotating",
    "object:scaling",
    "object:moving"
];
//Socket connection
CanvasIO.socket = io.connect('http://localhost:8080');
//Canvas events fired
for (e in CanvasIO.events) {
    CanvasManager.canvas.on(e, function(data){
        CanvasIO.socket.emit("canvas:event", {
            eventType: e,
            data: data
        });
    });
}
//Socket IO event received
CanvasIO.socket.on("canvas:event", function(data) {
    console.log("Received: " + data.eventType);
});
My problem is that in the Canvas Event Fired part I wish to generate automatic messages to be emitted based on the events name. But because I use eventType: e every message will get the last state of e, "object:moving".
So, for:
CanvasManager.canvas.on(key, handler)
Would it be possible to access the key within the handler? If not, how should I proceed?
 
     
     
    