SecureHandlerAttributeTemplate 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. SecureHandlerAttributeTemplate executes snippets whenever an attribute on the frame (whose name does not begin with "_") changes value.

Snippets Edit

The handler executes the following snippets in a restricted environment:

_onattributechanged (self, name, value) 
The snippet is executed when the an attribute changes value; unless its name begins with an underscore.
Secure frame handle to the frame.
String - attribute name.
Mixed - new attribute value. 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

Suppose we wanted to respond to :SetFrameRef() invocations on the frame by handling the frame in some fashion.

local frame = CreateFrame("FRAME", "MyAttributeFrame", UIParent, "SecureHandlerAttributeTemplate");
frame:SetAttribute("_onattributechanged", [=[
 if name:match("frameref%-.+") then
  -- value is nil, since the original type is userdata. 
  -- We can fix that by asking for the frame ref:
  value = self:GetFrameRef(name:match("frameref%-(.+)"));
  -- Now handle the name/value pair in some fashion...
  print("SetFrameRef: ", name, value);
frame:SetFrameRef("ref", frame);

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.