Changes

Jump to navigation Jump to search
m
no edit summary
Line 65: Line 65:  
== Shared script ==
 
== Shared script ==
   −
TBD
+
A library can have any number of trigger scripts, of action scripts, & of custom data source scripts. If there are things you do repetitively in scripts, you can put them in a shared script, and they will be available to any other script that runs.
 +
 
 +
For instance, trigger scripts are the most often used type of script, and in trigger scripts, it is very common and common practice to define a variable e to contain the current Entry object — var e = entry(). Then, you can say e.field() instead of entry().field. This not only saves keystrokes & makes the code more readable, but also runs a bit faster, because the entry() function is run only once in the script. This might be the first thing you'd think of to share. Of course, entry() is not called at all in library action scripts, for instance, so e will not be used in such scripts, but it doesn't hurt much at all, so it's OK that the code is shared also to these scripts.
    
== Trigger script ==
 
== Trigger script ==

Navigation menu