You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
413 B
17 lines
413 B
|
3 years ago
|
const isQQ = window.qq &&
|
||
|
|
window.qq.miniProgram &&
|
||
|
|
/QQ/i.test(navigator.userAgent) &&
|
||
|
|
/miniProgram/i.test(navigator.userAgent)
|
||
|
|
|
||
|
|
export function initWebviewApi (readyCallback) {
|
||
|
|
if (!isQQ) {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if (window.QQJSBridge && window.QQJSBridge.invoke) {
|
||
|
|
setTimeout(readyCallback, 0)
|
||
|
|
} else {
|
||
|
|
document.addEventListener('QQJSBridgeReady', readyCallback)
|
||
|
|
}
|
||
|
|
return window.qq.miniProgram
|
||
|
|
}
|