Context equality protection is indeed useful when you want to protect the same function from running on two distinct instances, as described in #8. However, equality isn't always expected. Here's an example:
In this case, I want to operate a single debounced function that will shared between the event listener and resize observer. However, when the function gets invoked, it receives different contexts that lead to the exception:
However, those contexts come from totally different classes and don't violate the issue described in #8.
Changes Made
Additionally to the context check, I also added the prototype equality check. That will help to dismiss false exceptions when the context differs between instances of unrelated classes.
Issue
Context equality protection is indeed useful when you want to protect the same function from running on two distinct instances, as described in #8. However, equality isn't always expected. Here's an example:
In this case, I want to operate a single debounced function that will shared between the event listener and resize observer. However, when the function gets invoked, it receives different contexts that lead to the exception: However, those contexts come from totally different classes and don't violate the issue described in #8.
Changes Made
Additionally to the context check, I also added the prototype equality check. That will help to dismiss false exceptions when the context differs between instances of unrelated classes.