1

我是 Parse.com CloudCode 和 Node.js 的新手

我正在尝试找到一种方法来创建一个带有一些查询和其他常见代码的帮助模块,我可能需要在我的应用程序中一遍又一遍地使用这些代码。

如何使用不同步的辅助方法创建模块?

我怎样才能使它与承诺一起工作? http://blog.parse.com/2013/01/29/whats-so-great-about-javascript-promises/

这是我的意图....我不确定正确的方法是什么

我收到此错误:TypeError: Cannot call method 'then' of undefined

exports.getMyObjects = function (myParam, status) {

var MyObject = Parse.Object.extend("MyObject");

var query = new Parse.Query(MyObject);

query.get(myParam).then(function(myObjects){

status.success(myObjects);

},function(error){

 status.error(error);
});

};

//Here on another file I'm trying to use the module

var helper = require('cloud/helper.js');

helper.getMyObjects('sdfsd43').then(function(myObjects){

 //Objects found!
},function(error){

//Error
});

// I'm getting thes error from parse: TypeError: Cannot call method 'then' of undefined
4

1 回答 1

0

我有一个类似的问题,并且能够通过更改 global.json 中的解析版本来解决它

“全球的”: {

"parseVersion": "1.2.7"

}

于 2013-11-19T02:19:30.873 回答