mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-10-31 16:21:46 +01:00 
			
		
		
		
	Use require so we can import conditionally
This commit is contained in:
		
							parent
							
								
									527c390152
								
							
						
					
					
						commit
						ed9c29d365
					
				| @ -20,6 +20,11 @@ limitations under the License. | ||||
| import VectorBasePlatform from './VectorBasePlatform'; | ||||
| import dis from 'matrix-react-sdk/lib/dispatcher'; | ||||
| 
 | ||||
| const electron = require('electron'); | ||||
| const remote = electron.remote; | ||||
| 
 | ||||
| electron.remote.autoUpdater.on('update-downloaded', onUpdateDownloaded); | ||||
| 
 | ||||
| function onUpdateDownloaded(ev, releaseNotes, ver, date, updateURL) { | ||||
|     dis.dispatch({ | ||||
|         action: 'new_version', | ||||
| @ -29,14 +34,6 @@ function onUpdateDownloaded(ev, releaseNotes, ver, date, updateURL) { | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| // index.js imports us unconditionally, so we need this check here as well
 | ||||
| let electron = null, remote = null; | ||||
| if (window && window.process && window.process && window.process.type === 'renderer') { | ||||
|     electron = require('electron'); | ||||
|     electron.remote.autoUpdater.on('update-downloaded', onUpdateDownloaded); | ||||
|     remote = electron.remote; | ||||
| } | ||||
| 
 | ||||
| export default class ElectronPlatform extends VectorBasePlatform { | ||||
|     setNotificationCount(count: number) { | ||||
|         super.setNotificationCount(count); | ||||
|  | ||||
| @ -17,16 +17,13 @@ See the License for the specific language governing permissions and | ||||
| limitations under the License. | ||||
| */ | ||||
| 
 | ||||
| import ElectronPlatform from './ElectronPlatform'; | ||||
| import WebPlatform from './WebPlatform'; | ||||
| 
 | ||||
| let Platform = null; | ||||
| 
 | ||||
| if (window && window.process && window.process && window.process.type === 'renderer') { | ||||
|     // we're running inside electron
 | ||||
|     Platform = ElectronPlatform; | ||||
|     Platform = require('./ElectronPlatform');; | ||||
| } else { | ||||
|     Platform = WebPlatform; | ||||
|     Platform = require('./WebPlatform');; | ||||
| } | ||||
| 
 | ||||
| export default Platform; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user