Fandom

WoWWiki

SecureHandlerStateTemplate

104,634pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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 Edit

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 Edit

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.

<Frame name="MyStateFrame" inherits="SecureHandlerStateTemplate" parent="UIParent" protected="true">
 <Attributes>
   <Attribute name="_onstate-foo" value="if newstate == 'show' then self:Show(); else self:Hide(); end" />
 </Attributes>
 <Scripts>
  <OnLoad>
   SecureHandler_OnLoad(self); -- Our OnLoad handler overwrites this one, so execute it now.
   RegisterStateDriver(self, "foo", "[target=target,exists,harm] show; hide");
  </OnLoad>
 </Scripts>
 <Size x="64" y="64"/>
 <Anchors><Anchor point="CENTER"/></Anchors>
<Layers>
Layer definitions are only valid on pages of namespace "Layer"
</Layers>
</Frame>


Also on Fandom

Random Wiki