Skip to content

Instantly share code, notes, and snippets.

@anushshukla
Created June 30, 2019 08:27
Show Gist options
  • Select an option

  • Save anushshukla/f2f838c2ef0282d32fbc7d69e51c3cf9 to your computer and use it in GitHub Desktop.

Select an option

Save anushshukla/f2f838c2ef0282d32fbc7d69e51c3cf9 to your computer and use it in GitHub Desktop.
Get Revised Open Application List on pressing of Alt + Tab (no of tab hits, matters)
function moveElement(array, fromIndex, toIndex) {
var element = array[fromIndex];
array.splice(fromIndex, 1);
array.splice(toIndex, 0, element);
}
function getTabList(openApplicationsCount, tabKeyPressedCount, openApplicationsList) {
var activeTabApplicationIndex = tabKeyPressedCount - 1;
// var activeApplicationTab = openApplicationsList[activeTabApplicationIndex];
// openApplicationsList.splice(activeTabApplicationIndex, 1);
// openApplicationsList.unshift(activeApplicationTab);
moveElement(openApplicationsList, activeTabApplicationIndex, 0);
return openApplicationsList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment