Javascript 让存储触发的谷歌云功能中的上下文可用
我正在谷歌云功能中尝试这段代码,由云存储节点10触发 我不知道如何使上下文可用<代码>事件:${context.eventId} 我尝试过:module.exports.getDevices(context)=getDevices 我尝试过:module.exports.getDevices=getDevices(上下文)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:
如果需要异步函数,只需将其声明为:
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;
完美,更好的方法。完美,更好的方法。