在 Mobile Safari 上调试缓慢的 angular-ui-router 状态更改

2024-04-14移动开发问题
7

本文介绍了在 Mobile Safari 上调试缓慢的 angular-ui-router 状态更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在编写一个 Angular 应用程序,使用 angular-ui-router 来管理状态/路由.

I'm writing an angular app, using angular-ui-router to manage states / routing.

在桌面浏览器(Chrome/Safari)上运行良好.但是,在 iPhone 4 上的 IOS 6 上的 Mobile Safari 上(以及在 iPhone 5 上的 IOS 7 上的较小扩展)上,通过 $state.go 更改状态可能需要长达 2 秒的时间.

On desktop browsers (Chrome / Safari) this is working fine. However, on Mobile Safari on IOS 6 on iPhone 4 (and to a lesser extend on IOS 7 on iPhone 5) changing state, via $state.go, can take anything up to 2 seconds.

我使用的是 ngTouch,所以我不认为原生点击事件需要 300 毫秒才能触发.不调用 $state.go 的 ngClick 属性现在似乎几乎可以立即工作.

I'm using ngTouch, so I don't think that it's the 300ms that the native click event takes to fire. ngClick attributes that don't call $state.go now seem to work pretty much instantaneously.

如何调试它以找到时间花费的地方?

How can I debug this to find where the time is being spent?

推荐答案

ngTouch 不适用于 ui-sref 指令.我们使用 fastclick.js 来处理点击行为,并移除了 ngTouch.问题是指令会踩到彼此的事件,实际上是不兼容的.你可以通过阅读这两个指令的实现来看到这一点.

ngTouch doesn't work with the ui-sref directive. We used fastclick.js to handle the click behavior, and removed ngTouch. The issue is that the directives step on each others events, and are in fact incompatible. You can see this by reading the implementation of both directives.

这篇关于在 Mobile Safari 上调试缓慢的 angular-ui-router 状态更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

[ios.cocos2d+box2d]如何禁用自动旋转?
[ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)...
2024-08-12 移动开发问题
7

从 Documents 目录存储和读取文件 iOS 5
Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)...
2024-08-12 移动开发问题
9

如何在 cocos2d 环境之外实现 cocos2d 游戏的虚拟摇杆?
How can I implement a virtual joystick for a cocos2d game outside the cocos2d environment?(如何在 cocos2d 环境之外实现 cocos2d 游戏的虚拟摇杆?)...
2024-08-12 移动开发问题
13