Skip to content

Instantly share code, notes, and snippets.

@MarshySwamp
Last active September 28, 2022 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarshySwamp/8d94e12597fe101451a5412bf8f3510f to your computer and use it in GitHub Desktop.
Save MarshySwamp/8d94e12597fe101451a5412bf8f3510f to your computer and use it in GitHub Desktop.
Functions, Functions, Functions!
function main() {
alert("This is a declared function and is invoked by calling it by name from suspend history.");
}
app.activeDocument.suspendHistory("Run script", "main()");
// or
(function (){
alert("This is an anonymous self-invoking function! Also known as an 'Immediately Invoked Function Expression' or (IIFE).");
}());
// or
main("parameter");
function main(parName) {
alert("This is a declared function and is invoked by calling it by name. It also includes a passed " + parName + "!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment