Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active June 22, 2016 23:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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