web-view.js 411 字节
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6 7 8 9
import api from './web-view-api'

const isAppPlus = /uni-app/i.test(navigator.userAgent)

const readyRE = /complete|loaded|interactive/

export function initWebviewApi (readyCallback) {
  if (!isAppPlus) {
    return
10 11 12 13 14
  }
  if (window.plus && readyRE.test(document.readyState)) {
    setTimeout(readyCallback, 0)
  } else {
    document.addEventListener('plusready', readyCallback)
fxy060608's avatar
fxy060608 已提交
15 16 17
  }
  return api
}