---
title: onLaunch
framework: tvmljs
role: symbol
role_heading: Instance Property
path: tvmljs/app/1627407-onlaunch
---

# onLaunch

A callback function that is automatically called when the app has been launched.

## Declaration

```data
attribute function onLaunch;
```

## Discussion

Discussion Use the onLaunch attribute to start any required actions (for example, loading the first TVML page) when the app launches. This attribute must be set to a function that accepts an options argument; for example App.onLaunch = function (options) {}. The options argument can contain the following keys: launchContext—Determines how the app is launched. Set to background to launch the app in the background. location—Contains the boot TVMLKit JS URL location. reloadData—The object passed in to App.reload() when the app is relaunched. User defined keys—Any custom keys that were passed to launchOptions.

## See Also

### Responding to App Life Cycle Events

- [onError](tvmljs/app/1627353-onerror.md)
- [onExit](tvmljs/app/1627419-onexit.md)
- [onResume](tvmljs/app/1627415-onresume.md)
- [onSuspend](tvmljs/app/1627431-onsuspend.md)
