///
import { createLifeCycle as createLifeCycleBase, ComponentInternalInstance } from '@vue/composition-api'
import * as app from './app'
import * as mp from './mp'
export {
initUtsProxyClass,
initUtsProxyFunction,
initUtsIndexClassName,
initUtsClassName,
initUtsPackageName,
} from './uts'
const lifecycles: string[] = []
const createLifeCycle = (lifecycle: string) => {
lifecycles.push(lifecycle)
const fn = createLifeCycleBase(lifecycle)
return (callback: T, target?: ComponentInternalInstance | null) => {
return fn(callback, target)
}
}
if (typeof plus === 'object') {
app.init()
} else if (typeof window === 'object' && 'document' in window) {
// TODO H5
} else {
mp.init(lifecycles)
}
export const onShow = createLifeCycle('onShow')
export const onHide = createLifeCycle('onHide')
export const onLaunch = createLifeCycle('onLaunch')
export const onError = createLifeCycle('onError')
export const onPageNotFound = createLifeCycle('onPageNotFound')
export const onUnhandledRejection = createLifeCycle('onUnhandledRejection')
export const onThemeChange = createLifeCycle('onThemeChange')
export const onUniNViewMessage = createLifeCycle('onUniNViewMessage')
export const onInit = createLifeCycle('onInit')
export const onLoad = createLifeCycle('onLoad')
export const onReady = createLifeCycle('onReady')
export const onUnload = createLifeCycle('onUnload')
export const onPullDownRefresh = createLifeCycle('onPullDownRefresh')
export const onReachBottom = createLifeCycle('onReachBottom')
export const onShareAppMessage = createLifeCycle('onShareAppMessage')
export const onShareTimeline = createLifeCycle('onShareTimeline')
export const onAddToFavorites = createLifeCycle('onAddToFavorites')
export const onPageScroll = createLifeCycle('onPageScroll')
export const onResize = createLifeCycle('onResize')
export const onTabItemTap = createLifeCycle('onTabItemTap')
export const onNavigationBarButtonTap = createLifeCycle('onNavigationBarButtonTap')
export const onBackPress = createLifeCycle('onBackPress')
export const onNavigationBarSearchInputChanged = createLifeCycle('onNavigationBarSearchInputChanged')
export const onNavigationBarSearchInputConfirmed = createLifeCycle('onNavigationBarSearchInputConfirmed')
export const onNavigationBarSearchInputClicked = createLifeCycle('onNavigationBarSearchInputClicked')