Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active June 22, 2016 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/0e738b4a14fde16f3af6b03fbc8e03dd to your computer and use it in GitHub Desktop.
Save conanak99/0e738b4a14fde16f3af6b03fbc8e03dd to your computer and use it in GitHub Desktop.
function get(url) {
return new Promise((resolve, reject) => {
// Lấy hình từ gái xinh.com
// Nếu bị lỗi thì đành thất hứa
if (error) reject("Error");
// Nếu lấy được thì thực hiện lời hứa
resolve(xxxImage);
});
}
var promise = ajax.get("gaixinh.info");
// Có hình thì fap, không có thì alert lỗi
promise
.then(image => fap)
.catch((error) => alert(error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment