Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var q = require('q');
- function cutSeat(WIPchair){
- var def = q.defer();
- console.log("Cut the chair's seat.");
- WIPchair.seat = "A nice seat for the chair.";
- def.resolve(WIPchair);
- return def.promise;
- }
- function assembleLegs(WIPchair){
- var def = q.defer();
- console.log('Assemble chair legs.');
- WIPchair.legs = "Chair legs.";
- def.resolve(WIPchair);
- return def.promise;
- }
- function buildChair(){
- WIPchair = {};
- cutSeat(WIPchair).then(assembleLegs).then(function (DONEchair){
- console.log(JSON.stringify(DONEchair,null,4))
- });
- }
- buildChair();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement