... $.fn.annotateEdit = function(image, note) { if (note) { this.note = note; } else { var newNote = new Object(); newNote.id = \"new
There is no dedicated language mechanism for it. The common pattern is to store the this in local (closure) variable (often named self or that) of the outer function:
this
self
that
var self = this; var innerFunction = function() { self.x = 1; };