2018-12-18 22:45:20 +08:00

31 lines
823 B
TypeScript

import renderApp from './render'
import { isClashX, setupJsBridge } from '@lib/jsBridge'
// import * as OfflinePluginRuntime from 'offline-plugin/runtime'
/**
* Global entry
* Will check if need setup jsbridge
*/
if (isClashX()) {
setupJsBridge(renderApp)
} else {
renderApp()
}
// PWA install
// OfflinePluginRuntime.install({
// onUpdateReady: () => {
// console.log('SW Event:', 'onUpdateReady')
// // Tells to new SW to take control immediately
// OfflinePluginRuntime.applyUpdate()
// },
// onUpdated: () => {
// console.log('SW Event:', 'onUpdated')
// // Reload the webpage to load into the new version
// window.location.reload()
// },
// onUpdateFailed: () => {
// console.error('SW Event:', 'onUpdateFailed')
// }
// })