Search Results

Search found 1 results on 1 pages for 'mirat can bayrak'.

Page 1/1 | 1 

  • Calling function from an object with event listener

    - by Mirat Can Bayrak
    i have a view model something like this: CANVAS = getElementById... RemixView = function(attrs) { this.model = attrs.model; this.dragging = false; this.init(); }; RemixView.prototype = { init: function() { CANVAS.addEventListener("click", this.handleClick); }, handleClick: function(ev) { var obj = this.getHoveredObject(ev); }, getHoveredObject: function(ev) {} ... ... } rv = new RemixView() the problem is my when clickHandler event fired, this object is being equal to CANVAS object, not RemixView. So i get error that says: this.getHoveredObject is not a function What is correct approach at that stuation?

    Read the article

1