global.subscribe at folder-level script
Copy link to clipboard
Copied
i try for test
global.radius=2;
global.subscribe("radius", RadiusChanged);
function RadiusChanged(x)
{
app.alert(x);
}
i have
Exception in line 2 of function top_level, script Folder-Level:App:test.js
GeneralError: Operation failed.
Global.subscribe:2:Folder-Level:App:test.js
whats wrong ?
Copy link to clipboard
Copied
What are you trying to do? Line 2 doesn't make sense.
Copy link to clipboard
Copied
general error != sense absense 🙂
Copy link to clipboard
Copied
global has no function wth the name subscribe
Copy link to clipboard
Copied
subscribe is global method
Copy link to clipboard
Copied
RadiusChanged is not defined
Copy link to clipboard
Copied
That shouldn't matter. It appears like that in the Reference and it works from the Console, just not from a folder-level script, not even if you place it in a trusted function. It seems it can't be used in that way.
Copy link to clipboard
Copied
global.subscribe("radius", RadiusChanged); must be declared from an open document. You get an error in a folder level script because it runs before a document is open. Remove it from the folder level script and put it in a document level script.

