javascript - Parse.Cloud.afterSave 方法不起作用

标签 javascript parse-platform parse-cloud-code

每次将新对象保存到名为“Message”的类时,我都尝试运行此云代码,但是我相信我错误地调用了 afterSave 方法,因为在保存新对象后,甚至我的 console.log 也没有显示反对我的名为“Message”的类(class)。我的代码有什么问题吗?

Parse.Cloud.afterSave("sendMessage", function(Message, response) {
  var messageBody = null;
  var messageSenderName = null;
  var messageSenderId = null;
  var randUsers = [];
  console.log("The variables were set");
 ............other code that doesn't matter................
});

最佳答案

据我所知,每当新条目保存到 Parse DB 时,您都希望启动云功能。 对于这种情况,afterSave 是可行的方法。但是,您的函数声明是错误的。该函数必须采用以下格式;

Parse.Cloud.afterSave("Message", function(request) {
.....
}

其中请求包含当前保存的条目信息。希望这有帮助。问候。

关于javascript - Parse.Cloud.afterSave 方法不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26221576/

相关文章:

javascript - CloudCode promise 系列,辅助函数给出错误 "Object has no method ' apply'"

javascript - 解析云代码-在 "normal"函数中查询用户问题

node.js - 解析嵌套的 Promise?

javascript - taffyDB 不保存数据

Javascript LocalStorage 作用域

javascript - 更改 d3 缩放中的矩形尺寸

javascript - 使用 Javascript 更改背景颜色后 :hover don't change the color

ios - 限制解析查询

php - fatal error : Uncaught exception 'Parse\ParseException' with message 'SSL certificate problem: unable to get local issuer certificate'

android - 强制安装新的解析器