mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Code refactoring
Flow first look
This commit is contained in:
parent
2f841524cb
commit
e6e0b02849
71 changed files with 2092 additions and 1836 deletions
|
|
@ -7,18 +7,20 @@ import {trim} from 'Common/Utils';
|
|||
|
||||
class Audio
|
||||
{
|
||||
notificator = null;
|
||||
player = null;
|
||||
|
||||
supported = false;
|
||||
supportedMp3 = false;
|
||||
supportedOgg = false;
|
||||
supportedWav = false;
|
||||
supportedNotification = false;
|
||||
|
||||
constructor() {
|
||||
this.notificator = null;
|
||||
|
||||
this.supportedMp3 = false;
|
||||
this.supportedOgg = false;
|
||||
this.supportedWav = false;
|
||||
this.supportedNotification = false;
|
||||
|
||||
this.player = this.createNewObject();
|
||||
|
||||
this.supported = !bMobileDevice && !bSafari && !!this.player && !!this.player.play;
|
||||
if (this.supported && this.player.canPlayType)
|
||||
if (this.supported && this.player && this.player.canPlayType)
|
||||
{
|
||||
this.supportedMp3 = '' !== this.player.canPlayType('audio/mpeg;').replace(/no/, '');
|
||||
this.supportedWav = '' !== this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, '');
|
||||
|
|
@ -35,7 +37,7 @@ class Audio
|
|||
this.supportedNotification = false;
|
||||
}
|
||||
|
||||
if (this.supported)
|
||||
if (this.supported && this.player)
|
||||
{
|
||||
const stopFn = () => this.stop();
|
||||
|
||||
|
|
@ -137,4 +139,4 @@ class Audio
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = new Audio();
|
||||
export default new Audio();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue