Last active
January 12, 2017 18:08
-
-
Save EddyVerbruggen/a01f9bf634ea9d8e067c93bc8cf0330a to your computer and use it in GitHub Desktop.
NativeScript HomeKit - creating Homes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HomeKit } from "nativescript-homekit"; | |
import { prompt, PromptResult } from "ui/dialogs"; | |
// instantiate the plugin's main Class | |
const homeKit = new HomeKit(); | |
// ask the user for a name and add it to HomeKit | |
prompt("Name the home").then((promptResult: PromptResult) => { | |
if (promptResult.result) { | |
homekit.addHome(promptResult.text).then( | |
(home: Home) => console.log(`Added home named ${home.name}`), | |
err => alert(err) | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment