草庐IT

query-timeout

全部标签

javascript - Jasmine : Timeout - Async callback was not invoked within timeout

我需要测试一个从url加载图像的AngularJs服务。这是我的服务:/*globalangular,Image*/(function(){'usestrict';functionSourceLoader($q,$log){/***Loadanimagefromurlandreturnapromisewhichisresolvedwhenimageisloadingisdone.*Itreturntheimagesobjectasresolvedpromise.*@paramurlsourceoftheimage*@returns{Promise}unresolvedpromiseof

javascript - Firebase promise - Query.once 失败 : Was called with 1 argument. 预计至少 2

我正在尝试使用promises将来自Firebase的一些数据填充到一个数组中。这是数据库结构:-domainname(orsomething)|--highscore|--Foo:50|--Bar:60代码:vararr=[];highscoreRef.child('highscore').once('value').then(function(snapshot){snapshot.forEach(function(data){arr.push({playerName:data.key(),score:data.val()});});},function(error){console

javascript - 将参数传递给 AngularJS $timeout

我正在开发一个ionic移动应用程序,我需要将参数传递给$timeoutpromise,以便我可以使用该参数进行一些操作。我阅读了有关$timeout(https://docs.angularjs.org/api/ng/service/$timeout)的angularjs文档,它说最后一个参数可以是传递给超时函数的参数。我试过这个:$timeout(function(params){alert(params.p1+"-"+params.p2);},5000,true,{p1:"Hello",p2:"World"});但它不起作用,我无法访问超时函数内的params变量。我做错了什么吗

javascript - Parse.Query 按日期排序

有没有办法在解析时按createdAt时间排序?例如:varUsers=Parse.Object.extend("Users"),Query=Parse.Query;varuserQuery=newQuery(Users);userQuery.equalTo("userName",Name);userQuery.ascending("createdAt"); 最佳答案 是的,没问题...但是Users类的字符串名称不是Users,而是“_Users”...更好的是:newParse.Query(Parse.User);varuser

javascript - 链接 Angular $timeout

我正在尝试将调用链接到AngularJS的$timeout函数。我在这里看到很多线程允许链接promise,有些线程专门使用Angular的$q,但这看起来应该非常简单。我想我错过了一些明显的东西。这是我喜欢做的事情:$timeout(firstFunction,firstDelay).then($timeout(secondFunction,secondDelay)).then($timeout(thirdFunction,thirdDelay));当所有三个函数都被调用时,$timeout会同时启动。我明白为什么这不起作用,但是如何我如何得到我想要的?我什至可以在这里使用promi

javascript - "Found @client directives in query but no client resolvers were specified"使用客户端缓存时出现警告

我一直在关注ApolloClientdocs在地方州。我实现了一个非常简单的客户端缓存查询:exportconstGET_USER_ACCOUNTS=gql`queryGetUserAccounts{userAccounts@clientname@client}`;userAccounts和name在验证后都存储在我的缓存中:{localStorage.setItem('token',token);client.writeData({data:{isLoggedIn:true,userAccounts,name:`${givenName}${familyName}`,},});}}>并

javascript - 火力地堡 'A network error (such as timeout, interrupted connection or unreachable host) has occurred.'

我正在尝试为我的数据库客户端编写一些测试,这要求我首先对Firebase进行身份验证。我使用Jest作为我的测试运行器。我的测试看起来像:it('shouldsignin',async(done)=>{try{awaitauth.signInWithEmailAndPassword('testabc@test.com','testuser');}catch(e){console.log(e);}done();});我的firebase应用已初始化,我已验证APIkey是否正确。一些有趣的注意事项是,即使我得到:'Anetworkerror(suchastimeout,interrupt

javascript - AngularJS $timeout 在计算值之前不等待 UI-Router 完成渲染

我正在使用angularJS和requirejs通过angularAMD将一个复杂的应用程序连接在一起。我的一个状态有两个简单的View,如下所示:$stateProvider.state("common",{url:"/",views:{"view1":{templateUrl:"view1.tpl.html"},"view2":{templateUrl:"view2.tpl.html"}}});htmlView1有一个指令:.directive('checkViewOneBoxWidth',function($timeout){return{restrict:'A',link:fu

javascript - Chrome 扩展 : make chrome. tabs.query() 同步

我目前正在使用这段代码:url="unknown";chrome.tabs.query({'active':true,'lastFocusedWindow':true},function(tabs){console.log(tabs);//test,printsone-elementarrayasexpectedurl=tabs[0].url;});$("#url_div").html(url);获取当前URL,但chrome.tabs.query()是异步,我怎样才能使其同步?(即在某处添加asynch:false)我知道我可以在查询内设置URL,或者从那里调用另一个函数,但最好是(

javascript - chrome.tabs.getCurrent() 或 tabs.query()

两种方法都产生相同的错误UncaughtTypeError:Cannotreadproperty'query'ofundefined我的内容脚本...我已经看过HowtofetchURLofcurrentTabinmychromeextensionusingjavascript和Howdoyouusechrome.tabs.getCurrenttogetthepageobjectinaChromeextension?尽管我仍然不确定自己做错了什么。list.json{"name":"ExtensionTester","version":"0.0.1","manifest_version