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