To use jsPax Packages you need to load the Script into your HTML:
Then jsPax needs to know where your packages can be found:
$package.packageBase = 'http://www.example.com/packages/';
Now you can use packages:
$using() returns immediatelly and loads the Packages assynchonously. You can not expect the Packages
to be loaded after
That is all you need to use existing packages.
the packages name.
package.js provides the function
$package(name,object) to make that
easier. The most simple package would then be:
Of course you can just create this Object at the end of an existing JS-File to make Packages from legacy code.
Packages are installed simply by copying them to the correct directory. The directory can be determined by $package.packageBase and the packages name:
Take the packages name and replace all '.' with '/'. Then append '.js' to that string and append the result to the package base. Then you have the URL where your package will be loaded from.
An Example: Your package is named 'com.example.test' and your package base is 'http://www.example.com/packages/'. Then you replaceall '.' with '/' in the Packagename: 'com/example/test', append '.js': 'com/example/test.js'. Now append this string to your package base: http://www.example.com/packages/com/example/test.js - that is the URL where jsPax will look for your package.
I have used JSquash for compression.
You can use jsPax under the terms of the GNU LGPL
There is a testsuite for jspax as well. Please go ahead, test the server installation and report any problems to me.