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.
32 lines
583 B
32 lines
583 B
const isQuickapp = window.qa &&
|
|
/quickapp/i.test(navigator.userAgent)
|
|
|
|
export function initWebviewApi (readyCallback) {
|
|
if (!isQuickapp) {
|
|
return
|
|
}
|
|
if (window.QaJSBridge && window.QaJSBridge.invoke) {
|
|
setTimeout(readyCallback, 0)
|
|
} else {
|
|
document.addEventListener('QaJSBridgeReady', readyCallback)
|
|
}
|
|
const {
|
|
navigateTo,
|
|
navigateBack,
|
|
switchTab,
|
|
reLaunch,
|
|
redirectTo,
|
|
postMessage,
|
|
getEnv
|
|
} = window.qa
|
|
|
|
return {
|
|
navigateTo,
|
|
navigateBack,
|
|
switchTab,
|
|
reLaunch,
|
|
redirectTo,
|
|
postMessage,
|
|
getEnv
|
|
}
|
|
}
|
|
|