Article View: adobe.scripting.indesign
Article #1866Re: pls explain abt prototype
From: Dirk.Becker
Date: Tue, 20 Jan 2009 22:21
Date: Tue, 20 Jan 2009 22:21
16 lines
1094 bytes
1094 bytes
You can preset a default value for all instances of employee.
This only occupies one slot in the prototype,rather than one per instance when preset in the constructor. I do it regularly for methods. Maybe run a speed test?
For methods it even works with InDesign's native objects.
// make global"Pages" object available
app.activeDocument.pages;
Pages.prototype.fancy = function ()
{
$.writeln(this.length);
}
app.activeDocument.pages.fancy();
"Done";
// See ESTK console for output
Technical Details
Message-ID:
<59b78cbc.3@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b78cbc.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,ba3fc2ccca9a708d X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Dirk.Becker <indesign-lists@jdbecker.de> Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: pls explain abt prototype Message-ID: <59b78cbc.3@webcrossing.la2eafNXanI> Date: Tue, 20 Jan 2009 14:21:37 -0800 References: <59b78cbc.-1@webcrossing.la2eafNXanI> Lines: 19 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit