我想将这些类添加到我的Parse Cloud Code中:
function Rule = {
this.accessor = new Accessor();
this.act = new Action();
}
Rule.prototype.sendEmail = function(email, threshold, bill){
if (this.accessor.check(threshold, bill)){
this.act.actionTake(email, threshold, bill);
}
};
function Accessor = {
}
Accessor.prototype.check = function(threshold, bill){
return bill > threshold;
};
function Action = {
}
Action.prototype.actionTake = function(email, threshold, bill){
//send email code
};
但是当我把它添加到javascript文件的最顶层时
我得到Update failed with Could not load triggers. The error was Uncaught SyntaxErrorL Unexpected token in main.js:1
Parse Cloud Code是否仅用于定义后台作业和云功能?是否可以在Parse Cloud Code中添加“类”定义?
谢谢
答案 0 :(得分:3)
var Rule = function() {
this.accessor = new Accessor();
this.act = new Action();
};
或
function Rule() {
this.accessor = new Accessor();
this.act = new Action();
}
基本的js语法,与解析
无关