mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
Extend the use of ResizeObserver by dropping all knockoutjs observable this.resizerTrigger in mail composer
As benefit this also drops the CustomEvent('resize.real')
This commit is contained in:
parent
35c9f3fff5
commit
d1c06a8ece
10 changed files with 48 additions and 117 deletions
|
|
@ -31,20 +31,6 @@ class AbstractApp extends AbstractBoot {
|
|||
this.isLocalAutocomplete = true;
|
||||
this.lastErrorTime = 0;
|
||||
|
||||
addEventListener(
|
||||
'resize',
|
||||
(()=>{
|
||||
const iH = $win.height(),
|
||||
iW = $win.height();
|
||||
|
||||
if ($win.__sizes[0] !== iH || $win.__sizes[1] !== iW) {
|
||||
$win.__sizes[0] = iH;
|
||||
$win.__sizes[1] = iW;
|
||||
dispatchEvent(new CustomEvent('resize.real'));
|
||||
}
|
||||
}).throttle(50)
|
||||
);
|
||||
|
||||
const $doc = document;
|
||||
$doc.addEventListener('keydown', (event) => {
|
||||
if (event && event.ctrlKey) {
|
||||
|
|
|
|||
|
|
@ -80,31 +80,6 @@ import { AbstractApp } from 'App/Abstract';
|
|||
|
||||
const doc = document;
|
||||
|
||||
if (!window.ResizeObserver) {
|
||||
window.ResizeObserver = class {
|
||||
constructor(callback) {
|
||||
callback = callback.debounce(250);
|
||||
this.observer = new MutationObserver(mutations => {
|
||||
let i = mutations.length;
|
||||
while (i--) {
|
||||
if ('style' == mutations[i].attributeName) {
|
||||
callback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.observer.disconnect();
|
||||
}
|
||||
|
||||
observe(target) {
|
||||
this.observer.observe(target, { attributes: true });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class AppUser extends AbstractApp {
|
||||
constructor() {
|
||||
super(Remote);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue