Javascript

Creating a Javascript Singleton

Synopsis

This article will demonstrate how to create a singleton for use in Javascript programs.

Singleton?

In object oriented programming, a singleton is a class that is instantiated only once. Most programmers find the idea of a singleton counter-intuitive when first introduced to them. Most of the time, we create classes so we can create many instances of them; after all, it doesn't make much sense to create a database application that can work with only a single employee at a time.

Rich Text Editing: Part II

Synopsis

In the previous article I discussed dynamically creating an iframe to be used as the input area for a rich text control; the focus of this article is to attach event handlers to the iframe.

There are at least two good reasons for capturing events on the iframe. The first is that if you are authoring a rich text control, then you will need to capture some of the iframe events so that the toolbar is appropriately updated when the user clicks in the editing area. For example, if the user clicks in the middle of a bold word, you will want to depress the corresponding icon on the toolbar. The second reason is that the client application of your rich text control may want to attach event handlers to your object; in order to provide this functionality, your control will have to export this functionality.

A working example can be seen here.

Rich Text Editing: Part I

Synopsis

This article details how to create an iframe to use as a replacement for a <textarea>; the iframe is intended to be the destination for user input in a rich text control.

A working example can be seen here.

Syndicate content