Saturday, July 11, 2025

Archive for the ‘Prototype’ Category

Nov
09

Prototype Marquee

Post Categories: DevelopmentJavascriptPrototype |Posted on November 9th, 2008

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
You can find examples and the project page.

Tags: ,

6 Comments »
Oct
27

Prototype Package Class

Post Categories: DevelopmentJavascriptPrototype |Posted on October 27th, 2008

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: , ,

No Comments »

Search

  • Article Categories

  • You are currently browsing the archives for the Prototype category.

    2008 © kevinandre. All rights reserved.
    Powered by WordPress
    188 spam comments
    blocked by
    Akismet