HTML and CSS Reference
our application. Here is a brief run-down of what we will be creating:
The base class for objects that need to broadcast events to other objects
A class that represents the draggable objects in the application
A class that represents the “retained mode” that we will simulate for our application
A recourse file filled with nifty functions that we can reuse
The main application class
The HTML file that pulls all of our code together
You can find these files in the Chapter 11 /draganddrop folder in the code distribution.
dispatch events. Standard DOM objects can have event listeners to listen for events—for ex-
However, Canvas images and drawing paths cannot create events because they are not kept
use as the base class for other objects. We will use the EventDispatcher object as the base
class for our Ornament class, so when an ornament is clicked, we can dispatch an event and
the subscriber to that event can take some action.
theCanvas . addEventListener ( "mouseup" , onMouseUp , false
EventDispatcher.js needs the following three methods: