App

The App class is your start point for any app. This class should be extended and exported from app.js. Methods prefixed with on are meant to be overriden. It is not allowed to overwrite the constructor.

Example

/app.js

const Homey = require('homey');

class MyApp extends Homey.App {
  async onInit() {
    this.log('MyApp has been initialized');
  }
}

module.exports = MyApp;

Extends

Properties

homey

homey: Homey

The Homey instance of this app

Type

id

id: string

The app id

Type

  • string

manifest

manifest: any

The app.json manifest

Type

  • any

sdk

sdk: number

The app sdk version

Type

  • number

Methods

error

error(…args)

Emits the __error event with args as parameters.

Parameters

Name Type Description
args
* <repeatable>

log

log(…args)

Emits the __log event with args as parameters.

Parameters

Name Type Description
args
* <repeatable>

onInit

(async) onInit()

This method is called upon initialization of your app.

onUninit

(async) onUninit()

This method is called when your app is destroyed.