jspkg

Javascript Package Loader

jspkg is a package loader for Javascript, based on pluggable loaders for locating and loading scripts into a client-side Javascript application. It is designed to work best with unobtrusive Javascript libraries, but doesn't impose any methodology or design on its users.

jspkg is currently available under a creative commons license.

What's happening with jspkg?

For updates, visit the project blog.

What does jspkg give me?

jspkg handles the automatic dependency resolution of packages for you, so you don't need to update the script includes of your page based on the libraries you need to use.

jspkg manages the global namespace for you, ensuring that libraries not directly imported by your code won't end up inadvertenly affecting your code.

jspkg packages export only the global classes and functions that the author intends. All other definitions within the package are considered private and won't clutter the global namespace.

jspkg will ensure that the libraries required by your code are available before your code executes, ensuring the end of timing-releated headaches.

How do I use jspkg?

For libary consumers: Using jspkg is as simple as including a link to the jspkg script in the HEAD section of your code. Once you've loaded the script, you can load all your other jspkg-enabled libraries through simple code.

For library authors: Enabling your libary for use within jspkg consists of wrapping your code in a call to org.jspkg.API1.definePackage and adding global class/function exports at the end of your library. For example, var MyClass = { }; can be exported by this.MyClass = MyClass;.

For more information on using jspkg, see the examples page. You can also see the latest examples from the CVS repostory.

Basic jspkg documentation is also available.

Where do I get it?

jspkg can be downloaded from the Sourceforge download page. The latest and greatest is available via CVS.

What browsers are supported by jspkg?

jspkg supports all Gecko-based browsers, IE5.0+ and Safari/WebCore. Note that not all platforms are currently tested.

What about JSAN?

jspkg has different design goals than JSAN. jspkg doesn't require the use of XMLHttpRequest or server-side dependency resolution. By default, jspkg uses an asynchronous script loading technique that should be compatible with any Javascript-capable environment.

jspkg provides hooks to write custom package or script loaders so that jspkg can be used in environments other than a web browser.

In addition, jspkg handles the management of namespaces and the automatic inclusion of namespaced items into the global namespace (the window object in HTML, for example).

Since jspkg uses regular <script> blocks by default, libraries can be debugged with standard Javascript debuggers such as Visual Studio and Mozilla's Venkman debugger.

If any of the information regarding JSAN is out-of-date or incorrect, please let the author know and it will be corrected.