// Example 31
//
// Works with AJS
// Will work only in part with AJS_HP
//
function Prefix_0 () { alert ("Prefix_0 executed"); }
function Prefix_1 () { alert ("Prefix_1 executed"); }
function Prefix_2 () { alert ("Prefix_2 executed"); }
function Prefix_3 () { alert ("Prefix_3 executed"); }
function MyFunc () { alert ("MyFunc executed"); }
var PrefixObj = AJS.AddPrefix (this, "MyFunc", Prefix_0);
PrefixObj = PrefixObj.AddAfter (Prefix_1);
PrefixObj = PrefixObj.AddAfter (Prefix_2);
PrefixObj = PrefixObj.AddAfter (Prefix_3);
MyFunc ();
while (PrefixObj.GetPrev () !== PrefixObj)
{
PrefixObj = PrefixObj.GetPrev ();
}
PrefixObj.Remove ();
MyFunc ();
--------------------------------------
Output (using AJS):
Prefix_0 executed
Prefix_1 executed
Prefix_2 executed
Prefix_3 executed
MyFunc executed
Prefix_1 executed
Prefix_2 executed
Prefix_3 executed
MyFunc executed
// Example 32
//
// Works with AJS
// Will work only in part with AJS_HP
//
function Prefix () { }
function MyFunc () { }
var PrefixObj = AJS.AddPrefix (this, "MyFunc", Prefix);
PrefixObj.ID = "Prefix 5";
PrefixObj.AddAfter (Prefix).ID = "Prefix 1";
PrefixObj.AddAfter (Prefix).ID = "Prefix 2";
PrefixObj.AddAfter (Prefix).ID = "Prefix 3";
PrefixObj.AddAfter (Prefix).ID = "Prefix 4";
MyFunc ();
var OldObj = null;
while (OldObj !== PrefixObj)
{
alert ("Affix ID = " + PrefixObj.ID);
OldObj = PrefixObj;
PrefixObj = PrefixObj.GetNext ();
}
--------------------------------------
Output (using AJS):
Affix ID = Prefix 5
Affix ID = Prefix 4
Affix ID = Prefix 3
Affix ID = Prefix 2
Affix ID = Prefix 1
// Example 33
//
// Works with AJS
// Will work only in part with AJS_HP
//
function Prefix_0 () { alert ("Prefix_0 executed"); }
function Prefix_1 () { alert ("Prefix_1 executed"); }
function Suffix_0 () { alert ("Suffix_0 executed"); }
function Suffix_1 () { alert ("Suffix_1 executed"); }
function MyFunc () { alert ("MyFunc executed"); }
AJS.AddWrapper (this, "MyFunc", Prefix_0, "", Infinity, Suffix_0);
MyFunc ();
var WrapperObj = AJS.AddWrapper (this, "MyFunc", Prefix_1, "", Infinity, Suffix_1);
MyFunc ();
WrapperObj.Prefix.Demote ();
WrapperObj.Suffix.Demote ();
MyFunc ();
--------------------------------------
Output (using AJS):
Prefix_0 executed
MyFunc executed
Suffix_0 executed
Prefix_0 executed
Prefix_1 executed
MyFunc executed
Suffix_1 executed
Suffix_0 executed
Prefix_1 executed
Prefix_0 executed
MyFunc executed
Suffix_0 executed
Suffix_1 executed