Many javascript libraries like MooTools, Dojo, ExtJS, YUI, and Qooxdoo have their source code organized in a structure that developers can use as a basis for organizing their own code. MooTools, YUI, and ExtJS have an online means of selecting the pieces of code needed and downloading a single script with all the selected code and required dependencies. This is great for optimizing the target library, but your code left not optimized: existing in separate files, uncompressed, and a polluter of the global namespace (if you care). This article describes one means for solving these issues.
Read the rest of this entry »
Tags: Javascript, Optimize, Organize
2 Comments »
While developing a website for a client, I was tasked with creating text that would fade in and out continuously. I figured that use case would be useful for many websites so I decided to create a class. It turns out the class is useful for cases where any html content has to be shown and hidden. The class is called Marquee.
I wrote several methods for controlling the Marquee class. Although I didn’t implement them for my current use case, I though they would be useful in the future. Methods included are
- load
- append
- start
- stop
- clear
- empty
- next
- previous
The class also accepts various options for configuring the Marquee and its messages. Last, I thought it would useful to monitor the different states of the Marquee so it allows several events to be observed. These are:
- start
- stop
- change
- before
- after
Tags: JavaScript Frameworks, Prototype
6 Comments »
There’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
No Comments »