Skip to content

Instantly share code, notes, and snippets.

@michael-hawker
Created June 21, 2017 16:03
Show Gist options
  • Save michael-hawker/ae92239d4f451a080e7382437cfd0e5a to your computer and use it in GitHub Desktop.
Save michael-hawker/ae92239d4f451a080e7382437cfd0e5a to your computer and use it in GitHub Desktop.
Windows 10 JavaScript Example which Simply Opens Native Calendar/Mail/People Applications without any context
window.addEventListener("DOMContentLoaded", (ev) => {
if (typeof Windows !== 'undefined') {
document.getElementById("calendar").addEventListener("click", () => {
Windows.ApplicationModel.Appointments.AppointmentManager.showTimeFrameAsync(new Date(Date.now()), 1);
});
document.getElementById("mail").addEventListener("click", () => {
Windows.System.Launcher.launchUriAsync(new Windows.Foundation.Uri("mailto:"));
});
document.getElementById("people").addEventListener("click", () => {
Windows.System.Launcher.launchUriAsync(new Windows.Foundation.Uri("ms-people:"));
});
} else {
document.getElementsByTagName("body")[0].innerHTML = "Load within Windows Web App.";
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment