Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 让存储触发的谷歌云功能中的上下文可用_Javascript_Node.js_Google Cloud Platform_Google Cloud Functions - Fatal编程技术网

Javascript 让存储触发的谷歌云功能中的上下文可用

Javascript 让存储触发的谷歌云功能中的上下文可用,javascript,node.js,google-cloud-platform,google-cloud-functions,Javascript,Node.js,Google Cloud Platform,Google Cloud Functions,我正在谷歌云功能中尝试这段代码,由云存储节点10触发 我不知道如何使上下文可用事件:${context.eventId} 我尝试过:module.exports.getDevices(context)=getDevices 我尝试过:module.exports.getDevices=getDevices(上下文) 如果需要异步函数,只需将其声明为: exports.helloGCS = async (file, context) => { console.log(` Event:

我正在谷歌云功能中尝试这段代码,由云存储节点10触发

我不知道如何使上下文可用<代码>事件:${context.eventId}

我尝试过:module.exports.getDevices(context)=getDevices

我尝试过:module.exports.getDevices=getDevices(上下文)


如果需要异步函数,只需将其声明为:

exports.helloGCS = async (file, context) => {
  console.log(`  Event: ${context.eventId}`);
};
如果希望它调用命名函数:

async function getDevices(file, context) {
  console.log(`  Event: ${context.eventId}`);
}

exports.helloGCS = getDevices;

如果需要异步函数,只需将其声明为:

exports.helloGCS = async (file, context) => {
  console.log(`  Event: ${context.eventId}`);
};
如果希望它调用命名函数:

async function getDevices(file, context) {
  console.log(`  Event: ${context.eventId}`);
}

exports.helloGCS = getDevices;

完美,更好的方法。完美,更好的方法。