1# app.js 2 3 4## Application Lifecycle 5 6 You can customize the [lifecycle](js-framework-lifecycle.md) implementation logic on an application-by-application basis in app.js. The following example only prints the corresponding logs in the lifecycle function: 7 8``` 9// app.js 10export default { 11 onCreate() { 12 console.info('Application onCreate'); 13 }, 14 15 onDestroy() { 16 console.info('Application onDestroy'); 17 }, 18} 19``` 20 21## Application Object<sup>6+</sup> 22 23 | Attribute | Data Type | Description | 24| -------- | -------- | -------- | 25| getApp | Function | Obtains the object exposed in the app.js file from the custom .js file. | 26 27The following is a sample code snippet: 28 29 30``` 31// app.js 32export default { 33 data: { 34 test: "by getAPP" 35 }, 36 onCreate() { 37 console.info('AceApplication onCreate'); 38 }, 39 onDestroy() { 40 console.info('AceApplication onDestroy'); 41 }, 42}; 43``` 44 45 46``` 47// test.js Customize the logic code. 48export var appData = getApp().data; 49``` 50