Returns promise (only if promise.constructor == Promise)
Make a promise that fulfills to obj. in this situation.
var promise = new Promise(function(resolve, reject) { | |
resolve(1); | |
}); | |
promise.then(function(val) { | |
console.log(val); // 1 | |
return val + 2; | |
}).then(function(val) { | |
console.log(val); // 3 | |
}); |
getJSON('story.json').then(function(story) { | |
return getJSON(story.chapterUrls[0]); | |
}).then(function(chapter1) { | |
console.log("Got chapter 1!", chapter1); | |
}); | |
/*************************/ | |
get('story.json').then(function(response) { | |
console.log("Success!", response); | |
}, function(error) { | |
console.log("Failed!", error); | |
}); | |
/************************************************/ | |
Promise.all(arrayOfPromises).then(function(arrayOfResults) { | |
//... | |
}); | |
/*****************************************************************/ | |
#!/bin/bash | |
# Get script path | |
SOURCE_DIR=/usr/local/src | |
SVN_VERSION=1.7.20 | |
SVN_SRC_DIR=$SOURCE_DIR/subversion-$SVN_VERSION | |
# Install dependencies | |
sudo apt-get -y install build-essential libxml2 libxml2-dev libxslt1-dev openssl libssl-dev |
#!/bin/bash | |
SOURCE_DIR=/usr/local/src | |
SVN_VERSION=1.7.20 | |
SVN_SRC_DIR=$SOURCE_DIR/subversion-$SVN_VERSION | |
# Install dependencies | |
sudo yum -y groupinstall "Development Tools" "Development Libraries" | |
sudo yum -y install libxml2 libxml2-devel libxslt-devel openssl openssl-devel |