I would like to know, how can I add peoperties to some KineticJS object. For example - I create two rectangles and connect them with a Line. And I need the object "line" knows about the two rectangles.
I could create a class Connector with atributtes object1, object2 and line (Kinetic.Line). But I can add to canvas only the line, so that I would lost the reference to Connector object, if I tried to get the line from canvas - for example after clicking on that.
If I understand your question correctly, its fairly simple
var rect1 = new Kinetic.Rect({...});
var rect2 = new Kinetic.Rect({...});
var line = new Kinetic.Line({...});
line.r1 = rect1;
line.r2 = rect2;
Now you can simply access the 2 rectangles by using line.r1 and line.r2