You know how to create an observer in your class definition, but you can also add an observer to an object, here is an example:
1 2 3 |
myProject.addObserver('status', function() { //write code to handle the observer }); |
This is pretty much an event listener. Just remember this will only fire for that one instance of the object. So if you had another myProject2 object instance, the observer will not fire.
Here is an example.