Open the console and run testSpec(); and see the source of this file.

The promise code:
dojo.provide("dojox.Promise");	

dojox._promiseId = 0;
 
dojox.Promise = function(){
	
	var topic = dojox._promiseId++;
	 
	return {
		_topic: topic,
		 
		emit: function(data){
			dojo.publish('/dojox/Promise/'+topic,[data||null]);
		},
		 
		then: function(doneHandler,errHandler){
			var promise = new dojox.Promise();
			dojo.subscribe('/dojox/Promise/'+topic, function(data){
				if(doneHandler && !(data instanceof Error)){
					var res = doneHandler(data);
					promise.emit(res);
				}
				if(errHandler && (data instanceof Error)){
					errHandler(data);
					promise.emit(data);
				}
			});
			return promise;
		}
	}
};

dojox.Promise.prototype.touched = 1;