---
title: getApp
---

## getApp(): AppObject

Get the global unique `App` instance for a miniapp.

## Example

```js
// other.js
var appInstance = getApp();
console.log(appInstance.globalData); // I am global data
```

## Notes

1. Do not call `getApp()` within functions defined inside `App()` or after calling `App()`. You can access the app instance using `this`.
2. After obtaining the app instance using `getApp()`, do not manually invoke lifecycle functions.

## Default Mode

> base library >= 2.16.0

If `getApp()` is called before `App()`, it will return a fake object `{__fake_app__: true}` instead of the actual `App` instance. Any properties and methods added to this object will be overridden on the real `App` instance. Please be mindful of property name conflicts.
