import { SHOW , HIDE , ERROR , LAUNCH , NOT_FOUND , SHARE , TAB_ITEM_CLICK } from '../constants' ; import { emit } from '../appLifeCycles' ; function initAppLifeCycles ( ) { window . addEventListener ( LAUNCH , ( { options , context } ) => { emit ( LAUNCH , context , options ) ; } ) ; window . addEventListener ( 'appshow' , ( { options , context } ) => { emit ( SHOW , context , options ) ; } ) ; window . addEventListener ( 'apphide' , ( { context } ) => { emit ( HIDE , context ) ; } ) ; window . addEventListener ( 'apperror' , ( { context , error } ) => { emit ( ERROR , context , error ) ; } ) ; window . addEventListener ( 'pagenotfound' , ( { context } ) => { emit ( NOT_FOUND , context ) ; } ) ; window . addEventListener ( 'appshare' , ( { context , shareInfo , options } ) => { emit ( SHARE , context , shareInfo , options ) ; } ) ; window . addEventListener ( 'tabitemclick' , ( { options , context } ) => { emit ( TAB_ITEM_CLICK , context , options ) ; } ) ; } export default initAppLifeCycles ;