Defferred Object usage

This is a sample example of how defferred works

by FrictionlessPulley

HTML

<div id="stage">this is the stage</div>
<div id="control">

</div>

CSS

#stage,#control {padding:1em;margin:.8em;}
#stage,#control {background-color:#ccd;border:1px dashed #000;width : 100px; height : 100px;} 
#control {float:right;}

JavaScript

var Performer = function(name){
    this.stage = $('#stage');
    this.name = name;
};

performer.prototype.introduce = function(){
    this.stage.html( this.name + 'on stage' + '<br/>');
    var promise = $.Deferred();
    return promise;
};

performer.prototype.perform = function(){
    this.stage.html( this.name + 'performing....' + '<br/>');
    var promise = $.Deferred();
    return promise;
};


var juggler = new Performer('Juggler');
juggler.perform();