调试量角器到角度同步问题的规范方法

调试量角器到角度同步问题的规范方法,第1张

调试量角器到角度同步问题的规范方法

好的,这个问题引起了我的兴趣,因此我想出了一个程序化的解决方案来确定如何等待量角器:

var _injector = angular.element(document).injector();var _$browser = _injector.get('$browser');var _$http = _injector.get('$http');var pendingTimeout = true;//this is actually method that protractor is using while waiting to sync//if callback is called immediately that means there are no $timeout or $http calls_$browser.notifyWhenNoOutstandingRequests(function callback () {  pendingTimeout = false});setTimeout(function () {  //this is to differentiate between $http and timeouts from the "notifyWhenNoOutstandingRequests" method  if (_$http.pendingRequests.length) {    console.log('Outstanding $http requests', _$http.pendingRequests.length)  } else if (pendingTimeout) {    console.log('Outstanding timeout')  } else {    console.log('All fine in Angular, it has to be something else')  }}, 100)

在这里,在http://plnkr.co/edit/O0CkpnsnUuwEAV8I2Jil?p=preview中,您可以尝试超时和$
http调用,我的延迟端点将等待10秒才能解决该调用,希望对您有所帮助为了你



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5639032.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存