# Registration Weixin Mini Program
Each Weixin Mini Program needs to be in theapagejscallsAppmethods to register instances of Mini Programs, bind lifecycle callback functions, error listening, and page non-existent listening functions.
Please refer to App reference document for detailed parameter meaning and usage.
// app.js
App({
onLaunch (options) {
// Do something initial when launch.
},
onShow (options) {
// Do something when show.
},
onHide () {
// Do something when hide.
},
onError (msg) {
console.log(msg)
},
globalData: 'I am global data'
})
The entire Weixin Mini Program has only one app instance, which is shared by all pages.Developers can obtain a globally unique App instance bygetAppmethod, obtain data on the App, or call functions that the developer registers onApp.
// xxx.js
const appInstance = getApp()
console.log(appInstance.globalData) // I am global data