dispatchEvent(new CustomEvent(...)) to fireEvent(...)

This commit is contained in:
the-djmaze 2022-02-11 12:21:16 +01:00
parent 2d46eaa783
commit 44ee236709
9 changed files with 25 additions and 21 deletions

View file

@ -1,6 +1,7 @@
import { SMAudio } from 'Common/Audio';
import * as Links from 'Common/Links';
import { addObservablesTo } from 'Common/Utils';
import { fireEvent } from 'Common/Globals';
/**
* Might not work due to the new ServiceWorkerRegistration.showNotification
@ -12,7 +13,7 @@ const HTML5Notification = window.Notification,
dispatchMessage = data => {
focus();
if (data.Folder && data.Uid) {
dispatchEvent(new CustomEvent('mailbox.message.show', {detail:data}));
fireEvent('mailbox.message.show', data);
} else if (data.Url) {
rl.route.setHash(data.Url);
}

View file

@ -3,7 +3,7 @@ import { koComputable } from 'External/ko';
import { Layout, EditorDefaultType } from 'Common/EnumsUser';
import { pInt, addObservablesTo } from 'Common/Utils';
import { $htmlCL, SettingsGet } from 'Common/Globals';
import { $htmlCL, SettingsGet, fireEvent } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
export const SettingsUserStore = new class {
@ -48,7 +48,7 @@ export const SettingsUserStore = new class {
$htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
$htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
$htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
dispatchEvent(new CustomEvent('rl-layout', {detail:value}));
fireEvent('rl-layout', value);
};
self.layout.subscribe(toggleLayout);
ThemeStore.isMobile.subscribe(toggleLayout);