/
my_worker.cfc
41 lines (32 loc) · 1.25 KB
/
my_worker.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
component name="my_worker" {
public any function init() {
variables.utils = new utilities();
return this;
}
remote any function usesUtil() {
var myArray = ["test1","test2","test3"];
return utils.mapper(myArray,this.mapAction);
}
public any function beforeUsesUtil() {
var myInfo = getComponentMetaData(this);
writeOutput("Before usesUtil() I still have my THIS scope!<br />I am '#myInfo.name#'.<hr />");
}
public any function mapAction() {
var myInfo = getComponentMetaData(this);
//I need my this so I can call my own functions but I don't have them anymore!
try {
this.duringUsesUtil();
} catch (any err) {
writeOutput("Called during usesUtil()... oops, no scope :-\");
writeDump(var=err.message);
}
writeOutput("Called from usesUtil() I've lost my identity!<br />I am '#myInfo.name#'.<hr />");
}
public any function duringUsesUtil() {
var myInfo = getComponentMetaData(this);
}
public any function afterUsesUtil() {
var myInfo = getComponentMetaData(this);
writeOutput("After usesUtil() I no longer have my THIS scope<br />I am '#myInfo.name#'.<hr />");
}
}