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.

Table of Contents

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

The Homey instance of this app

Type:

id :string

The app id

Type:
  • string

manifest :any

The app.json manifest

Type:
  • any

sdk :number

The app sdk version

Type:
  • number

Methods

error(…args)

Log a message to the console (stderr)

Overrides:
Parameters:
Name Type Attributes Description
args * <repeatable>

log(…args)

Log a message to the console (stdout)

Overrides:
Parameters:
Name Type Attributes Description
args * <repeatable>

(async) onInit()

This method is called upon initialization of your app.