我有 onclick
功能
<a onclick="func()"></a>
在主页面上,用户可以在该页面上加载所有脚本文件之前单击此链接,这样他们就会“空”点击它,他们太早按下按钮 .
Note: I'm not looking for how to load the script faster/in sync with the main page.
我的问题是如何"catch"这次点击和"store"只要它加载目标脚本然后继续 click
.
我认为.promise()可以做到这一点,但我以前从未使用它,有人能指出我正确的方向吗?
1 回答
在页面的开头,定义一个数组,您可以使用
push()
方法存储所有点击 . 然后在加载js文件时处理它们 .