object.save({ key: value }, {
success:function(object) {
// the object was saved.
},
error:function(object, error) {
// saving the object failed.
}
});
在新的Promise范式中,同样的代码你可以这样写:
object.save({ key: value }).then(
function(object) {
// the object was saved.
},
function(error) {
// saving the object failed.
});
Parse.User.logIn("user","pass", {
success:function(user) {
query.find({
success:function(results) {
results[0].save({ key: value }, {
success:function(result) {
// the object was saved.
}
});
}
});
}
});
Parse.User.logIn("user","pass").then(function(user) {
returnquery.find();
}).then(function(results) {
returnresults[0].save({ key: value });
}).then(function(result) {
// the object was saved.
});
Parse.User.logIn("user","pass", {
success:function(user) {
query.find({
success:function(results) {
results[0].save({ key: value }, {
success:function(result) {
// the object was saved.
},
error:function(result, error) {
// An error occurred.
}
});
},
error:function(error) {
// An error occurred.
}
});
},
error:function(user, error) {
// An error occurred.
}
});
Parse.User.logIn("user","pass").then(function(user) {
returnquery.find();
}).then(function(results) {
returnresults[0].save({ key: value });
}).then(function(result) {
// the object was saved.
},function(error) {
// there was some error.
});
doFailingAsync().then(function() {
// doFailingAsync doesn't succeed.
},function(error) {
// Try to handle the error.
return"It's all good.";
}).then(function(result) {
// Non-jQuery implementations will reach this with result === "It's all good.".
},function(error) {
// jQuery will reach this with error === "It's all good.".
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有