iPhone点击输入延迟

Meteor.js/javascript iPhone tap input lag

本文关键字:延迟 输入 iPhone      更新时间:2023-09-26

我不确定这是Meteor.js特有的问题,但这里是:

我在http://numbersdemo.meteor.com/创建了一个演示。如果你在桌面浏览器中尝试演示(我只在Mac上的Chrome浏览器中尝试过),它运行得很好,按钮的输入会立即显示在结果栏中。但如果你在iPhone上尝试,就不会那么快了。这就是我需要的!

有可能吗?

它是一个流星问题或只是javascript/HTML在移动Safari?

下面是应用程序的所有.js。正如你所看到的,没有DB连接正在进行,只是一个会话,所以DB不是问题。

if (Meteor.isClient) {
  Meteor.startup(function () {
    Session.set('buttonsResult', 0);
  });
  Template.numbersThing.result = function () {
    return Session.get('buttonsResult');
  };
  Template.numbersThing.events({
    'mousedown .button' : function (event) {
      var prevInput = Session.get('buttonsResult'),
      newInput = prevInput + '' + $(event.currentTarget).text();
      Session.set('buttonsResult', newInput);
    },
    'mousedown .reset' : function () {
      Session.set('buttonsResult', 0);
    }
  });
}
if (Meteor.isServer) {
  Meteor.startup(function () {
  });
}

您是否尝试过使用像touchstart这样的事件而不是mousedown?

尝试使用FastClick,这消除了点击链接时300ms的延迟时间