Best Practices

Search:

Welcome

Login to contribute. Register if you haven't yet.

Need Support?

Search this site to find an answer. If you still need help, post a Question. Private or account-related support inquiries can be made at the Private Support forum.

Use Libraries For Shared Code

If you find your self reusing code to do things, put it into a library that can be included in other scripts. Here's how this might look:

Library Page named MyLibrary:

<script type="text/vnd.editme.js"><![CDATA[
function MyClass()  {
   // some code here
}
]]></script>

Page Using the Library (note the check to avoid multiple nested inclusion; the text ' ' is just to keep the script tag from turning into <script/>, which browsers don't like): 

<div>
<script editme="if this.MyClass==undefined ;; process 'MyLibrary' ;; text ' ' "></script>
<script type="text/vnd.editme.js"><![CDATA[
  var myobject = new MyClass();
]]></script>
</div>