草庐IT

FUNCTIONS-DATETIME-EXTRACT

全部标签

javascript - 如何在 JavaScript Azure Functions 中共享代码?

如何在Azure函数应用程序的文件之间共享代码(例如Mongo架构定义)?我需要这样做,因为我的函数需要访问共享的mongo模式和模型,例如这个基本示例:varblogPostSchema=newmongoose.Schema({id:'number',title:'string',date:'date',content:'string'});varBlogPost=mongoose.model('BlogPost',blogPostSchema);我尝试将"watchDirectories":["Shared"]行添加到我的host.json并在该文件夹中添加了一个index.htm

javascript - Parse.com 云代码 : Chaining functions?

我确信这是一个简单的函数,但我就是无法在Parse.com的CloudCode中使用链式函数。我知道这是可能的-所以这可能是对我的javascriptn00bness的控诉。;>下面是一个简单的测试函数链,展示了我认为它应该如何工作——但它没有。在response.error事件中,我似乎遇到错误,但在成功时我得到:{"code":141,"error":"success/errorwasnotcalled"}下面是测试函数:Parse.Cloud.define("initialFunction",function(request,response){varplayer=request

javascript - Cloud Functions for Firebase 组织

我知道有人问过这个问题here,但它没有回答我的问题。我的问题是我们如何为CloudFunctions分解index.js,包括onWrite调用等。我知道您可以使用“require”并引入外部代码。它仍然在index.js中留下一些代码(例如,在FranksOCR示例中)。理想情况下,我希望能够将整个onWrite事件触发器移动到另一个文件。index.js中的示例:exports.sysQueueUserNew=functions.database.ref("/sys/queue/user_new/{queueId}").onWrite((event)=>{//dosomethin

javascript - 如何从 '/functions' 以外的目录部署函数?

David在他的仓库中:https://github.com/davideast/react-ssr-firebase-hosting在主根目录中有带有firebase函数的文件index.js,不在/functions目录中。但是,如果我这样做并将我的index.js文件放到主根目录,如果我执行firebasedeploy--onlyfunctions它会在控制台中显示:ideployingfunctionsError:functions\index.jsdoesnotexist,can'tdeployFirebaseFunctions问:他怎么可能让它起作用?我怎样才能从/func

javascript - firebase-functions.js 调用 firebase.functions() 时出现内部错误

正如标题所说,当我调用firebase.functions()时,我在firebase-functions.js库中遇到内部错误。一些上下文,这是纯js,不是nodeJS、React或Jquery,我正在尝试调用httpsCallable云函数。云函数是可调用的,并且按照android的预期工作。firebase-functions.js库版本为4.13.0。错误是:Error​code:"internal"​columnNumber:2043​details:undefined​fileName:"http://www.gstatic.com/firebasejs/4.13.0/fi

javascript - 调试显示模块模式 : functions not in scope until called?

如果我在Chrome开发者工具中运行这段代码:vartest=(function(){varpublicFunction,privateFunction1,privateFunction2;privateFunction1=functionprivateFunction1(){returntrue;};privateFunction2=functionprivateFunction2(){returntrue;};publicFunction=functionpublicFunction(){privateFunction1();debugger;};return{publicFunc

javascript - JS : How to track errors where there are many functions calls

每个函数都会创建新的错误对象。那么我怎样才能得到以前的错误呢?例如,这是我的代码:functionmain(callback){a(function(err){if(err){callback(newError('cannotrunmainfunction..'));return}})}functiona(callback){b(function(err){if(err){callback(newError('cannotrunbfunction'));return}})}functionb(callback){if(1==2)callback(newError('Errorinbfu

javascript - Azure Functions 执行速度极慢且不一致

我正在编写一些AzureFunctions脚本,用于从内部数据库读取和写入内部数据库,并将相关信息显示到网页中。我注意到在加载调用AzureFunction脚本的网页时,WebUI速度极慢甚至超时。经过进一步调查,我意识到以下几点:Azure函数脚本有时需要10秒到1分钟以上的时间才能连接到SQL数据库。有时脚本会在几毫秒内运行,有时需要3分钟以上才能完全运行脚本。这是我的Azure函数脚本:module.exports=function(context,req){context.log("FunctionStarted:"+newDate());//Importpackagecons

javascript - 将 .NET JavaScriptSerializer.Deserialize 与来自客户端的 DateTime 一起使用

我正在使用JavaScriptSerializer.Deserialize()将我从客户端接收到的JSON转换为自定义C#类的方法。该类的属性之一是DateTime.当前Deserialize()方法抛出一个错误,说"(mydatestring)"isnotavalidvalueforDateTime.我试过使用几种不同的格式发送日期,包括刻度和由各种内置JavaScriptDate()方法生成的其他格式,但都没有奏效。Deserialize()到底是什么格式?期望将其解析为.NET的方法DateTime? 最佳答案 你是对的,@f

javascript - react Hook : accessing state across functions without changing event handler function references

在基于类的React组件中,我执行如下操作:classSomeComponentextendsReact.Component{onChange(ev){this.setState({text:ev.currentValue.text});}transformText(){returnthis.state.text.toUpperCase();}render(){return();}}为了简化我的观点,这是一个人为的例子。我本质上想要做的是保持对onChange函数的持续引用。在上面的例子中,当React重新渲染我的组件时,如果输入值没有改变,它不会重新渲染输入。这里要注意的重要事项:t