WoW:API Frame HookScript: Difference between revisions

no edit summary
No edit summary
Line 1: Line 1:
{{widgetmethod}}
{{widgetmethod}}Sets a function to be called automatically after the original function is called, or "post hook". Works with secure frames. (secure)
Sets a function to be called automatically after the original function is called, or "post hook". Works with secure frames. (secure)
  frame:HookScript("handler", func)
  frame:HookScript("handler", func)


== Parameters ==
== Parameters ==
=== Arguments ===
=== Arguments ===
:;handler : string - the name of the handler type, like 'OnShow', 'OnClick'. See [[Widget handlers]].
:;handler
:;func : function - function to be called. Cannot be 'nil'.
:: string - the name of the handler type, like 'OnShow', 'OnClick'. See [[Widget handlers]].
:;func
:: function - function to be called. Cannot be 'nil'.


== Summary ==
== Summary ==
'HookScript' can be used on secure frames, where 'SetScript' would cause "taint" issues and bad UI behavior. Calls each hooked function after calling its original handler function. Any parameters returned by the hooking function will not be discarded, and not be passed to the original handler. Any handler added this way cannot be removed, and will stay until the UI is reloaded.
'HookScript' can be used on secure frames, where 'SetScript' would cause "taint" issues and bad UI behavior. Calls each hooked function after calling its original handler function. Any values returned by the hooking function will be discarded, and not be passed to the calling function (which is usually secure code). Any handler added this way cannot be removed, and will stay until the UI is reloaded.


== Examples ==
== Examples ==
Anonymous user