This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
Closed

Promise API

MatjaLipuMatjaLipu Member
edited February 2016 in Archive
Since Homey is currently using 0.12.9 which already supports promises and there is an upcoming upgrade to node 4 which is a LTS release.
I strongly suggest to switch to promises API.

That brings us developer friendly API.
Homey.manager('cloud').getLocalAddress().then(function(address) {
    // say my address
}).catch(function (err) {
    // handle error
})

With an upcoming ES7 await we could do even better.
async function searchYouTube() {
    var results = await Homey.manager('api').get('/app/com.youtube/search?q=hello')
    Homey.log(results)
}

Comments

  • I already use them in my Kodi app :). Love the API. Can't wait to release a v1 of the app.
  • Isn't Homey on node version 0.12.7 ? That is what Emile told me.
  • Panda said:
    Isn't Homey on node version 0.12.7 ? That is what Emile told me.
    For me
    process.version
    returns 0.12.9
This discussion has been closed.