Skip to content

Commit

Permalink
fix: 将调用间隔改为常量
Browse files Browse the repository at this point in the history
  • Loading branch information
Anshiii committed May 21, 2019
1 parent 78dca3f commit ec401f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/src/main/assets/WebViewJavascriptBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

var lastCallTime = 0;
var stoId = null;
var FETCH_QUEUE_INTERVAL = 20;

// 创建消息index队列iframe
function _createQueueReadyIframe(doc) {
Expand Down Expand Up @@ -85,9 +86,9 @@
}

// _fetchQueue 的调用间隔过短,延迟调用
if (new Date().getTime() - lastCallTime < 20) {
if (new Date().getTime() - lastCallTime < FETCH_QUEUE_INTERVAL) {
if (!stoId) {
stoId = setTimeout(_fetchQueue, 20);
stoId = setTimeout(_fetchQueue, FETCH_QUEUE_INTERVAL);
}
return;
}
Expand Down

0 comments on commit ec401f5

Please sign in to comment.