The CreatorCon Call for Content is officially open! Get started here.

Design pattern of writing a script include?

Mohd Shahnawaz
Tera Contributor

Design pattern of writing a script include?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Mohd,



I recommend you take a look at TechNow Episode 6 where Andrew and I take a dive in to script includes, their options, their function, passing information in and out etc.



TechNow Episode List


View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

Hi Mohd,



I recommend you take a look at TechNow Episode 6 where Andrew and I take a dive in to script includes, their options, their function, passing information in and out etc.



TechNow Episode List


Gowrisankar Sat
Tera Guru

A script include defines a class with one or more functions:



var myCustomClass = Class.create();


myCustomClass.prototype = {


  initialize: function() {


    },          


myCustomFunction: function () {


    ...


}



Calling a function defined in a script include:



var myVariable = new myCustomClass();


myCustomClass.myCustomFunction();


The prototype method is not always required or desired. It's very common to do it that way, but not always the necessary format. There are a few different formats you can use when defining script includes.



Again, all this is in episode 6 - TechNow Episode List