You just create the frame and call RegisterUnitWatch(frame) on it. If UnitExists(this:GetAttribute("unit")) returns true, it's automatically shown, otherwise hidden.
So, at init, do a frame:SetAttribute("unit", "target") and register that frame. Then use hooksecurefunc on OnShow to execute the line Perl_Target_Update_Once();
|