SecureHandlerStateTemplate

SecureHandlerStateTemplate is one of the SecureHandler templates introduced in Patch 3.0. Those templates exist in order to allow addon code to execute within a restricted environment, where it may perform protected actions but has access only to a limited subset of the API. SecureHandlerStateTemplate executes snippets whenever any attribute prefixed with "state-" changes value, making it ideal for use in combination with SecureStateDriver.

Snippets
The handler executes the following snippets in a restricted environment:
 * _onstate-identifier (self, stateid, newstate) : The snippet is executed when the "state-identifier" attribute changes value; identifier may be any arbitrary string of one or more characters.
 * self : Secure frame handle to the frame.
 * stateid : String - identifier of the changed state.
 * newstate : Mixed - new value of the "state-identifier" attribute. Note that if the value is not a string, boolean or a number, it'll be replaced with nil -- this a limitation enforced by the restricted environment.

Example
The frame defined in XML below will be shown only if you have a hostile target. Note that the frame also behaves properly in combat, even though it is protected.       SecureHandler_OnLoad(self); -- Our OnLoad handler overwrites this one, so execute it now. RegisterStateDriver(self, "foo", "[target=target,exists,harm] show; hide");       </Layers> </Frame>