Prototype Package Class
Post Categories: Development • Javascript • Prototype |Posted on October 27th, 2008There’s been quite a bit of talk about polluting the global namespace. It is certainly one of those things I try to be conscious of when I develop. I wanted a convenient means of creating namespaces and importing classes into them. This led to the development of Package.
Package provides a method for dynamically creating namespaces. These namespaces can be immediately used to create classes, simple functions, variables, etc. Existing classes that are organized in folder structures can be imported at any time using a namespace that resembles the path to the class.
Other javascript and css files can also be included on a page using the static include method.
Using the require and include methods make it possible to create web pages that load much faster by delaying the load of classes until you need them in your code. There are also two events (success and failure) that can be observed so that code can executed accordingly.
Check out the project page for usage information and examples.
Tags: Class, Javascript, Prototype