mirror of https://gitee.com/cf-fz/WebCAD.git
parent
7cabafc94a
commit
c075dc9db5
@ -0,0 +1,37 @@
|
||||
|
||||
function ActiveElementsWatch()
|
||||
{
|
||||
|
||||
let lastActiveElement = document.activeElement;
|
||||
function detectBlur()
|
||||
{
|
||||
// Do logic related to blur using document.activeElement;
|
||||
// You can do change detection too using lastActiveElement as a history
|
||||
}
|
||||
function isSameActiveElement()
|
||||
{
|
||||
let currentActiveElement = document.activeElement;
|
||||
if (lastActiveElement != currentActiveElement)
|
||||
{
|
||||
lastActiveElement = currentActiveElement;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function detectFocus()
|
||||
{
|
||||
// Add logic to detect focus and to see if it has changed or not from the lastActiveElement.
|
||||
console.log(document.activeElement);
|
||||
}
|
||||
|
||||
function attachEvents()
|
||||
{
|
||||
window.addEventListener('focus', detectFocus, true);
|
||||
|
||||
window.addEventListener('blur', detectBlur, true);
|
||||
}
|
||||
|
||||
attachEvents();
|
||||
|
||||
}
|
Loading…
Reference in new issue