Let's create a new record that mirrors the first Script Include in Chapter 3, Server-Side Control.
- Navigate to MID Server > Script Includes. Click New, fill out the fields below, and Save.
- Name: SimpleAdd
- Script:
var SimpleAdd = Class.create(); SimpleAdd.prototype = { initialize: function (n) { ms.log('Creating new object'); this.number = (n - 0) || 0; }, increment: function () { this.number++; ms.log(this.number); return this; }, type: 'SimpleAdd' }
This code is almost identical to a typical Script Include. The only difference is that the logging is done with the ms global variable instead of gs.
The script has two functions. One is run when the object is created and sets the number variable. The ...