Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Replace Existing Event Handler

$
0
0
Hi Neil,

ClearScript does not provide this capability. Handlers for a given event generally aren't aware of each other, and the only way to do what you want in .NET is via reflection. With ClearScript you can of course allow the script to use reflection, or provide an alternate event connection API that does what you want behind the scenes.

However, some events are naturally "single-cast". That is, the semantics of the event are such that only one handler should ever be connected. If you're developing the event source, consider if that applies to the event in question. If it does, you can use custom event accessors to provide the required behavior in an elegant manner. This article demonstrates the technique.

Thanks for your question, and good luck!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images