web-view.js 423 字节
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6 7 8
const isQQ = window.qq &&
  window.qq.miniProgram &&
  /QQ/i.test(navigator.userAgent) &&
  /miniProgram/i.test(navigator.userAgent)

export function initWebviewApi (readyCallback) {
  if (!isQQ) {
    return
9 10 11 12 13
  }
  if (window.QQJSBridge && window.QQJSBridge.invoke) {
    setTimeout(readyCallback, 0)
  } else {
    document.addEventListener('QQJSBridgeReady', readyCallback)
fxy060608's avatar
fxy060608 已提交
14 15 16
  }
  return window.qq.miniProgram
}