Skip to content

Instantly share code, notes, and snippets.

@EddyVerbruggen
Last active January 12, 2017 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EddyVerbruggen/a01f9bf634ea9d8e067c93bc8cf0330a to your computer and use it in GitHub Desktop.
Save EddyVerbruggen/a01f9bf634ea9d8e067c93bc8cf0330a to your computer and use it in GitHub Desktop.
NativeScript HomeKit - creating Homes
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