'use-strict'; class LocalStorage { constructor() { this.MEDIA_TYPE = { audio: 'audio', video: 'video', speaker: 'speaker', }; this.DEVICES_COUNT = { audio: 0, speaker: 0, video: 0, }; this.LOCAL_STORAGE_DEVICES = { audio: { count: 0, index: 0, select: null, }, speaker: { count: 0, index: 0, select: null, }, video: { count: 0, index: 0, select: null, }, }; } setLocalStorageDevices(type, index, select) { switch (type) { case this.MEDIA_TYPE.audio: this.LOCAL_STORAGE_DEVICES.audio.count = this.DEVICES_COUNT.audio; this.LOCAL_STORAGE_DEVICES.audio.index = index; this.LOCAL_STORAGE_DEVICES.audio.select = select; break; case this.MEDIA_TYPE.video: this.LOCAL_STORAGE_DEVICES.video.count = this.DEVICES_COUNT.video; this.LOCAL_STORAGE_DEVICES.video.index = index; this.LOCAL_STORAGE_DEVICES.video.select = select; break; case this.MEDIA_TYPE.speaker: this.LOCAL_STORAGE_DEVICES.speaker.count = this.DEVICES_COUNT.speaker; this.LOCAL_STORAGE_DEVICES.speaker.index = index; this.LOCAL_STORAGE_DEVICES.speaker.select = select; break; default: break; } localStorage.setItem('LOCAL_STORAGE_DEVICES', JSON.stringify(this.LOCAL_STORAGE_DEVICES)); } getLocalStorageDevices() { return JSON.parse(localStorage.getItem('LOCAL_STORAGE_DEVICES')); } setItemLocalStorage(key, value) { localStorage.setItem(key, value); } getItemLocalStorage(key) { localStorage.getItem(key); } }