The goog.labs.observe Namespace

The goog.labs.observe.Notice Class

A notice object encapsulates information about a notification fired by an observable. … more

The goog.labs.observe.Observable Interface

Interface for an observable object. @interface … more

The goog.labs.observe.ObservableSet Class

Creates a set of observables. An ObservableSet is a collection of observables. Observers may be reigstered and will receive notifications when any of the observables notify. This class is meant to simplify management of observations on multiple observables of the same nature. … more

The goog.labs.observe.ObservationSet Class

A set of observations. An observation is defined by an observable and an observer. The set keeps track of observations and allows their removal. … more

The goog.labs.observe.Observer Interface

A class implementing {@code Observer} may be informed of changes in observable object. … more

The goog.labs.observe.SimpleObservable Class

A simple implementation of {@code goog.labs.observe.Observable} that can be used as a standalone observable or as a base class for other observable object. When another class wants to implement observable without extending {@code SimpleObservable}, they can create an instance of {@code SimpleObservable}, specifying {@code opt_actualObservable}, and delegate to the instance. Here is a trivial example:

   ClassA = function() {
     goog.base(this);
     this.observable_ = new SimpleObservable(this);
     this.registerDisposable(this.observable_);
   };
   goog.inherits(ClassA, goog.Disposable);

   ClassA.prototype.observe = function(observer) {
     this.observable_.observe(observer);
   };

   ClassA.prototype.unobserve = function(observer) {
     this.observable_.unobserve(observer);
   };

   ClassA.prototype.notify = function(opt_data) {
     this.observable_.notify(opt_data);
   };
 
… more