The source code for these examples is available in the examples/scripts directory of the downloadable archive.
The JSLoad Example tests the JSLoad statement by using it to load the JSLoad.js external JavaScript file.
Test code ::
   JSLoad ("scripts/com/iskitz/js/packaging/examples/JSLoadExample.js");

   if(typeof isJSLoaded != "undefined")
   {
      isJSLoaded();
   }
   else
   {
      alert("Failed to load com/iskitz/js/packaging/examples/JSLoadExample.js "
            + "external JavaScript file!");
   }

JSLoadExample.js ::
   function isJSLoaded()
   {
      alert("JSLoad was successful!");
   }
   
The JSPackage Example tests the JSPackage statement by using it to create a package that is then accessed.
Test code ::
   // create com.iskitz.js.packaging.examples package
   JSPackage ("com.iskitz.js.packaging.examples");
      
   var status = "NOT";

   if(com != undefined)
      if(com.iskitz != undefined)
         if(com.iskitz.js.packaging != undefined)
            if(com.iskitz.js.packaging.examples != undefined)
               status = "successfully";

   alert("The com.iskitz.js.packaging.examples package\n"
         + "was [ " + status + " ] created!");
   
The JSImport Example tests the JSImport statement by using it to import an external function that is then executed using its shortened name.
Test code ::
   JSImport ("com.iskitz.js.packaging.examples.JSImportExample");

   if(typeof JSImportExample != "undefined")
      JSImportExample();
   else
      alert("com.iskitz.js.packaging.examples.JSImportExample\n"
            + "was NOT successfully imported");

JSImportExample.js ::
   JSPackage ("com.iskitz.js.packaging.examples");

   com.iskitz.js.packaging.examples.JSImportExample = function ()
   {
      alert("JSImportExample was successfully imported!");
   };
   
The Package Dependency Example tests JSPackaging's dependecy feature. This example imports an external JavaScript file that internally requires another external JavaScript file to function properly.
Test code ::
   JSImport ("com.iskitz.js.packaging.examples.Complex");

   var complex = new Complex();
   complex.sayHello();

Simple.js ::
   JSPackage ("com.iskitz.js.packaging.examples");

   com.iskitz.js.packaging.examples.Simple = function()
   {
      this.toString = function toString()
      {
         return "[Simple]";
      };
   };

Complex.js ::
   JSPackage ("com.iskitz.js.packaging.examples");

   JSImport ("com.iskitz.js.packaging.examples.Simple");

   com.iskitz.js.packaging.examples.Complex = function()
   {
      var simple = new Simple();
         	
      this.sayHello = function sayHello()
      {
         var message = "Hello World!\n\nThis is a " + this.toString()
                       + " object that imported and is\nusing a "
                       + simple.toString() + " object!";

         alert(message);
      };

      this.toString = function toString()
      {
         return "[Complex]";
      };
   };
   
The source code for these examples is available in the examples/scripts directory of the downloadable archive.