Closed FishOrBear closed 7 years ago
Hi @FishOrBear. You just need to apply the advice first:
let myObject = {
f: function clickHandle()
{
console.log("click");
}
}
window["obj"] = myObject;
var remover = meld.after(myObject, 'f', () =>
{
console.log("f after");
});
document.addEventListener("click", myObject.f)
Because functions in JS are immutable, meld advises object methods by overwriting them. That is meld.after(myObject, 'f', advice)
basically overwrites myObject['f'] = advice
.
Hope that helps.
Thank you
If you type obj.f () in the console it will trigger the "after" event correctly
it's working