我正在创建一个小型画布库,其中有一个需要引用自身的匿名函数。但是,我不知道该怎么做。我有以下不完整的代码:
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
});
当然可以换了??????使用arguments.callee,但它在严格模式下不起作用。还有其他选择吗?