EnTerr
9 years agoRoku Guru
To Whom the ObserveField() Tolls ?
I am struggling to understand the functioning of observeField(). The documentation is (un)usually sloppy, mumbling:
The problem is that the mis-labeled^ "function" above is not really a Function, it is a String. And as such it has to get resolved in some context to a B/S function proper. Whose context does that string get looked up in - when and how?
Note that while "fieldName" and "function" above both are Strings, they get resolved (looked up) in different contexts - fieldName will be looked up within the component to which observeField() is called. E.g. say calling
Herefore i ask - how, when and where is the callback function looked up?
(^) it should have been functionName. If the difference between "function" and "function name" is not apparent to someone, it might be time to re-visit the White Knight's song as an adult (yes, Lewis Carroll is very meta)
"ifSGNodeField.observeField()" wrote:
observeField(fieldName as String, function as String)
[...]
function - The function to call when the field value changes
[...]
First Form
This form calls the function specified by function when the subject node field specified by fieldName changes.
The problem is that the mis-labeled^ "function" above is not really a Function, it is a String. And as such it has to get resolved in some context to a B/S function proper. Whose context does that string get looked up in - when and how?
Note that while "fieldName" and "function" above both are Strings, they get resolved (looked up) in different contexts - fieldName will be looked up within the component to which observeField() is called. E.g. say calling
Noid.observeField("visible", "avoid")will put a contract on changes of Noid.visible - however the function avoid() that will be called may not be part of the Noid component. Or it may be. There might be different "avoid()" functions in different components. My point is, the name resolution works differently for "avoid" than for "visible".
Herefore i ask - how, when and where is the callback function looked up?
(^) it should have been functionName. If the difference between "function" and "function name" is not apparent to someone, it might be time to re-visit the White Knight's song as an adult (yes, Lewis Carroll is very meta)