Parse.Cloud.play找不到函数
Parse.Cloud.play can't find function
我想我误解了。play()函数中的一些东西。我花了好几天想弄明白。
我在main.js中有一个函数的定义设置。
var pvp_module = require('cloud/otherCode.js');
function pushBattleMessage_sum(request, response)
{
pvp_module.PushNotification_BattleMessageExport(request, response);
}
Parse.Cloud.define("PushNotification_BattleMessage", pushBattleMessage_sum);
这将它发送到运行该代码的另一个otherCode.js。在这段代码中,我需要调用第二个Cloud函数。
function PushNotification_BattleMessage(request, response)
{
Parse.Cloud.run("push_httpRequest",{request},
{
sucess: function(results)
{
response.success(results);
},
error: function(error)
{
response.error(error);
}
});
}
第二个云函数在main.js中定义
Parse.Cloud.define('push_httpRequest',function(request)
{
Parse.Cloud.httpRequest(
{
url: 'http://www.parse.com/',
success: function(httpResponse)
{
console.log(httpResponse.text);
},
error: function(httpResponse)
{
console.error('Request failed with response code ' + httpResponse.status);
}
});
});
我在网上找到的一切都告诉我,这应该是工作的,但在我的testharness html中,我总是收到错误"Uncaught ReferenceError: push_httpRequest未定义"
这段代码的目的是Android要求推送通知图标必须是黑色和白色的。我无法用服务器端解析初始化该更改,因此我们通过httpRequest为GCM设备提供推送通知。如果我能让第一个Cloud函数找到第二个的话,我就能把所有这些都放到一起了
就我在文档中看到的,Parse.Cloud
对象的define
方法需要一个函数,该函数应该接受两个参数。那么你的函数push_httpRequest
没有正确定义。来自Parse文档:
define( name, func )
定义一个云函数
仅在Cloud Code中可用。参数:
<String>
名称云函数名称- 函数
<Function>
注册云函数。这个函数应该有两个参数Parse.Cloud.FunctionRequest
和Parse.Cloud.FunctionResponse
相关文章:
- 在wordpress中找不到jQuery函数
- 在页面中找不到元素的正确位置.函数未考虑填充
- JavaScript函数在Safari中有效,但在Firefox中找不到
- 为什么当我使用初始化触发器函数时,我总是找不到脚本函数:发送发票如果新
- 找不到柴函数
- 找不到 jquery 输入自动完成函数
- 谷歌应用程序脚本-正在尝试使用getUrl.TypeError:在对象工作表中找不到函数getUrl
- 继续得到一个错误,即某个东西不是函数,但找不到原因
- Javascript 引用错误 - 在对象内找不到函数
- 谷歌脚本在对象中找不到函数LastIndexOf
- 找不到Google Apps脚本库嵌套函数
- 函数找不到变量
- jQuery函数找不到容器 - 可能是克隆错误
- $(document).ready() 中的函数找不到 DOM 的主体元素
- Ajax函数找不到正确的数据
- ReactJS映射函数找不到未定义的属性
- jQuery's getScript函数找不到我的.js.Rails中的动词模板
- jQuery的点击函数找不到选择器
- Angular 2-从JS文件(chart.JS)调用函数-找不到函数
- JS构造函数找不到全局变量