Is the dollar ($) object extensible?
Is it possible to add methods to ExtendScript $ object? If yes, how might it be acheived?
Is it possible to add methods to ExtendScript $ object? If yes, how might it be acheived?
Okay, after some time, here is how I ended up implementing new methods on the $ object. I assign an immediately executed function to a new property on the $ object. Then I can have a namespaced function methods I can call with $.
In a separate file, say "utils.jsx", from my main ExtendScript code, I've got something like this (just a basic form):
($.className = function () {
this.defaults = {
prop1 : "apples",
prop2 : "oranges",
prop3 : "bananas"
}
this.firstMethod = function(words) {
$.writeln("Now speaking: " + words);
}
return this;
}())
Then in my main ExtendScript code, I `#include` it, and begin to use the methods. Something like this:
#include 'utils.jsx';
$.className.firstMethod("e pluribus unum"); //outputs to console: 'Now speaking: e pluribus unum'
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.