Skip to content

Commit

Permalink
remove remaining traces of support for IE8
Browse files Browse the repository at this point in the history
  • Loading branch information
warpech committed Jul 2, 2019
1 parent bbd3002 commit 0250c05
Showing 1 changed file with 9 additions and 26 deletions.
35 changes: 9 additions & 26 deletions src/duplex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,11 @@ export function observe<T>(obj: Object|Array<T>, callback?: (patches: Operation[
observer.next = setTimeout(dirtyCheck);
};
if (typeof window !== 'undefined') { //not Node
if (window.addEventListener) { //standards
window.addEventListener('mouseup', fastCheck);
window.addEventListener('keyup', fastCheck);
window.addEventListener('mousedown', fastCheck);
window.addEventListener('keydown', fastCheck);
window.addEventListener('change', fastCheck);
}
else { //IE8
(<any>document.documentElement).attachEvent('onmouseup', fastCheck);
(<any>document.documentElement).attachEvent('onkeyup', fastCheck);
(<any>document.documentElement).attachEvent('onmousedown', fastCheck);
(<any>document.documentElement).attachEvent('onkeydown', fastCheck);
(<any>document.documentElement).attachEvent('onchange', fastCheck);
}
window.addEventListener('mouseup', fastCheck);
window.addEventListener('keyup', fastCheck);
window.addEventListener('mousedown', fastCheck);
window.addEventListener('keydown', fastCheck);
window.addEventListener('change', fastCheck);
}
}
observer.patches = patches;
Expand All @@ -121,18 +112,10 @@ export function observe<T>(obj: Object|Array<T>, callback?: (patches: Operation[
removeObserverFromMirror(mirror, observer);

if (typeof window !== 'undefined') {
if (window.removeEventListener) {
window.removeEventListener('mouseup', fastCheck);
window.removeEventListener('keyup', fastCheck);
window.removeEventListener('mousedown', fastCheck);
window.removeEventListener('keydown', fastCheck);
}
else {
(<any>document.documentElement).detachEvent('onmouseup', fastCheck);
(<any>document.documentElement).detachEvent('onkeyup', fastCheck);
(<any>document.documentElement).detachEvent('onmousedown', fastCheck);
(<any>document.documentElement).detachEvent('onkeydown', fastCheck);
}
window.removeEventListener('mouseup', fastCheck);
window.removeEventListener('keyup', fastCheck);
window.removeEventListener('mousedown', fastCheck);
window.removeEventListener('keydown', fastCheck);
}
};

Expand Down

0 comments on commit 0250c05

Please sign in to comment.