Skip to content

Instantly share code, notes, and snippets.

@anuith
Created December 20, 2012 19:14
Show Gist options
  • Save anuith/4347856 to your computer and use it in GitHub Desktop.
Save anuith/4347856 to your computer and use it in GitHub Desktop.
The function to unpin secondary tile
function unpinByElementAsync(element, unwantedTileID) {
var selectionRect = element.getBoundingClientRect();
var buttonCoordinates = { x: selectionRect.left, y: selectionRect.top, width: selectionRect.width, height: selectionRect.height };
var placement = Windows.UI.Popups.Placement.above;
var tileToDelete = new Windows.UI.StartScreen.SecondaryTile(unwantedTileID);
return new WinJS.Promise(function (complete, error, progress) {
tileToGetDeleted.requestDeleteForSelectionAsync(buttonCoordinates, placement).done(function (isDeleted) {
if (isDeleted) {
complete(true);
} else {
complete(false);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment