API ScriptObject HookScript

Securely post-hooks a script handler. success = ScriptObject:HookScript(scriptType, handler [, bindingType])

Arguments

 * scriptType : - Name of the script type, e.g. "OnShow".
 * handler : - The function to call; will be passed all arguments relevant for the hooked frame script type.
 * bindingType : - Specifies any intrinsic frame's pre/post handler to hook.

Returns

 * success : - Returns true if the hook was successfully installed, false if not.

Details

 * If the widget script type doesn't have an existing handler function, one will be created as if you called
 * An intrinsic can have irrevocable pre/post handlers. These cannot be set or changed, but they can be securely post-hooked using  . Hooking a nonexistent pre/post handler fails with a return value of false.

Example
Prints when you open the character frame. /run CharacterFrame:HookScript("OnShow", function(self) print(self:GetName.." was shown") end)

Prints when ChatFrame1 is shown when e.g. switching between chat tabs. ChatFrame1:HookScript("OnShow", function(self) 	print(self:GetName.." was shown (extrinsic)") end) ChatFrame1:HookScript("OnShow", function(self) 	print(self:GetName.." was shown (postcall)") end, LE_SCRIPT_BINDING_TYPE_INTRINSIC_POSTCALL)