草庐IT

firebase-console

全部标签

javascript - 如何在 Firebase 中按升序或降序检索分页子项?

假设我将firebase用于评论系统,并且我想检索给定主题的评论,但一个主题中有太多评论,我不想一次全部检索它们。我还希望最新的评论显示在顶部。似乎以相反顺序显示firebase记录的唯一方法是全部检索它们,然后反向迭代它们。这在大型数据集上可能会变得非常笨拙,尤其是对于移动客户端。有没有更好的办法?按升序或降序从Firebase查询分页数据的通用和首选解决方案是什么? 最佳答案 更新答案@Tyler回答stackoverflow.com/a/38024909/681290是这个问题的更新和更方便的答案TL;DR如果您想要做的是没有

javascript - Cloud Functions for Firebase 超时

用于获取数据库数据的简单云功能无法正常工作。getusermessage()不工作错误:Functionexecutiontook60002ms,finishedwithstatus:'timeout'用于获取数据库结果的Index.JS。constfunctions=require('firebase-functions');constadmin=require('firebase-admin');admin.initializeApp(functions.config().firebase);constcors=require('cors')({origin:true});//Ta

javascript - 如何停止警告 : It looks like you're using the development build of the Firebase JS SDK?

Itlookslikeyou'reusingthedevelopmentbuildoftheFirebaseJSSDK.WhendeployingFirebaseappstoproduction,itisadvisabletoonlyimporttheindividualSDKcomponentsyouintendtouse.FortheCDNbuilds,theseareavailableinthefollowingmanner(replacewiththenameofacomponent-i.e.auth,database,etc):https://www.gstatic.com/

javascript - 在 console.log 中显示对象属性的原始顺序

我需要进行一些调试以查看一个JavaScript对象属性的原始顺序,但是(至少在chromedevtools中)console.log()向我显示了一个按字母顺序排列的对象。例如:varobj={z:1,t:2,y:3,a:4,n:5,k:6}console.log(obj)显示:Object{z:1,t:2,y:3,a:4,n:5…}a:4k:6n:5t:2y:3z:1//expected(needed)originalorderz:1t:2y:3a:4n:5k:6 最佳答案 console.log确实对属性进行了排序,在某些情况

javascript - Firebase JS API 身份验证 - 帐户存在于不同的凭据

我们在尝试解决这个问题时遇到了真正的问题,因此希望得到一些Firebase的帮助/那些已经解决了同样问题的人。该应用程序是ReactNative(0.43.2)并使用FirebaseJSAPI(最新)我们提供Facebook和Google身份验证。工作正常。但是,如果用户:使用Facebook登录(可以)稍后,使用Google登录(也可以)稍后,尝试使用Facebook登录-砰!不太好,Firebase返回此错误:auth/account-exists-with-different-credential通过阅读文档和一些关于SO的帖子,我们认为以下内容是正确的,但显然不正确,因为我们得

javascript - Firebase "throw new Error(' 提供的服务帐户无效');"错误消息

我注意到Firebase最近发生了变化。我正在构建一个需要firebase的node.js应用程序,以前这就足够了:varFirebase=require("firebase");varfirebaseRef=newFirebase("https://blabla.firebaseio.com/");根据此链接:https://firebase.google.com/docs/web/setup#prerequisites您需要在新的firebase控制台中创建一个firebase项目,然后将firebase添加到您的网络应用程序中。这给你类似的东西://InitializeFireb

javascript - 从 javascript 增加 firebase 值,受约束

我在firebase中有一个值需要增加,它受竞争条件的影响,所以我更愿意一次完成所有这些。node:{clicks:3}我需要设置clicks=clicks+1只要clicks.我可以从WebAPI进行一次调用来执行此操作吗? 最佳答案 参见referencedocumentationforatransaction:varref=firebase.database().ref('node/clicks');ref.transaction(function(currentClicks){//Ifnode/clickshasneverb

javascript - 将 Firebase 托管根目录重定向到 Cloud Functions 不起作用

我将Firebase托管与firebase.json文件一起使用,该文件应该将所有流量转发到云函数(prerender),该函数为SEO填充meta和og标签。{"hosting":{"public":"dist/prod","rewrites":[{"source":"**","function":"prerender"}]}}我的prerender函数正在处理请求并呈现HTML文件。这很好用:exportconstprerender=functions.https.onRequest((req,res)=>{console.log('prerenderfunction:"'+req

javascript - Console.log 仅显示打印对象的更新版本

String.prototype.width=function(font){varf=font||'12pxarial',o=$(''+this+'').css({'position':'absolute','float':'left','white-space':'nowrap','visibility':'hidden','font':f}).appendTo($('body')),w=o.width();o.remove();returnw;}functionsortCustomFunction(a,b){if(a['text'].width()b['text'].width()

javascript - 当值被分配给组件状态时,为什么 console.log 打印以前的状态?

我将数字值从Numbers组件发送到Main组件。一切正常,直到我将主组件中的值设置为该组件的状态。varNumbers=React.createClass({handleClick:function(number){this.props.num(number)},render:function(){return(123)}})varMain=React.createClass({getInitialState:function(){return{number:0}},handleCallback:function(num){console.log("numberisrighthere