I'm creating a small canvas library in which I have an anonymous function which needs to reference to itself. However, I don't know how to do this. I have the following incomplete code:
var removeDragHandler = (function (object) {
return function (e) {
if (typeof object["dragend"] === "function") {
object["dragend"](e);
}
removeEvent({
element: window,
event: "mousemove",
callback: object["drag"]
});
removeEvent({
element: window,
event: "mouseup",
callback: ????? //What here?
});
};
})(object);
addEvent({
element: window,
event: "mouseup",
callback: removeDragHandler
});
Of course I could replace the ????? with arguments.callee, but then it doesn't work in strict mode. Are there any other options?