# AppObject getApp(Object object)

Gets the globally uniqueAppinstance to Weixin Mini Program.

# parameter

# Object object

attribute type Default values Required to fill in Introductions Minimum version
allowDefault boolean false no Returns the default implementation whenAppis not defined. When the app is invoked, the attributes defined in the default implementation are overwritten and incorporated into the app.Generally used for independent sub-packageing 2.2.4

# sample code

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

# Note

  • Do not call [[in a function defined inApp (), or before callingApp`` getApp (), usethisto get an app instance.
  • Do not call the life-periodic function after getting the instance throughgetApp ().