@@ -295,17 +295,15 @@ class EditorWindow extends ProjectRunningWindow {
295295 this . updateRichPresence ( ) ;
296296 } ) ;
297297
298- const ipc = this . window . webContents . ipc ;
299-
300- ipc . on ( 'is-initially-fullscreen' , ( e ) => {
298+ this . ipc . on ( 'is-initially-fullscreen' , ( e ) => {
301299 e . returnValue = isInitiallyFullscreen ;
302300 } ) ;
303301
304- ipc . handle ( 'get-initial-file' , ( ) => {
302+ this . ipc . handle ( 'get-initial-file' , ( ) => {
305303 return this . activeFileId ;
306304 } ) ;
307305
308- ipc . handle ( 'get-file' , async ( event , id ) => {
306+ this . ipc . handle ( 'get-file' , async ( event , id ) => {
309307 const file = getFileById ( id ) ;
310308 const { name, data} = await file . read ( ) ;
311309 return {
@@ -315,7 +313,7 @@ class EditorWindow extends ProjectRunningWindow {
315313 } ;
316314 } ) ;
317315
318- ipc . on ( 'set-locale' , async ( event , locale ) => {
316+ this . ipc . on ( 'set-locale' , async ( event , locale ) => {
319317 if ( settings . locale !== locale ) {
320318 settings . locale = locale ;
321319 updateLocale ( locale ) ;
@@ -333,11 +331,11 @@ class EditorWindow extends ProjectRunningWindow {
333331 } ;
334332 } ) ;
335333
336- ipc . handle ( 'set-changed' , ( event , changed ) => {
334+ this . ipc . handle ( 'set-changed' , ( event , changed ) => {
337335 this . window . setDocumentEdited ( changed ) ;
338336 } ) ;
339337
340- ipc . handle ( 'opened-file' , ( event , id ) => {
338+ this . ipc . handle ( 'opened-file' , ( event , id ) => {
341339 const file = getFileById ( id ) ;
342340 if ( file . type !== TYPE_FILE ) {
343341 throw new Error ( 'Not a file' ) ;
@@ -347,12 +345,12 @@ class EditorWindow extends ProjectRunningWindow {
347345 this . window . setRepresentedFilename ( file . path ) ;
348346 } ) ;
349347
350- ipc . handle ( 'closed-file' , ( ) => {
348+ this . ipc . handle ( 'closed-file' , ( ) => {
351349 this . activeFileId = null ;
352350 this . window . setRepresentedFilename ( '' ) ;
353351 } ) ;
354352
355- ipc . handle ( 'show-open-file-picker' , async ( ) => {
353+ this . ipc . handle ( 'show-open-file-picker' , async ( ) => {
356354 const result = await dialog . showOpenDialog ( this . window , {
357355 properties : [ 'openFile' ] ,
358356 defaultPath : settings . lastDirectory ,
@@ -380,7 +378,7 @@ class EditorWindow extends ProjectRunningWindow {
380378 } ;
381379 } ) ;
382380
383- ipc . handle ( 'show-save-file-picker' , async ( event , suggestedName ) => {
381+ this . ipc . handle ( 'show-save-file-picker' , async ( event , suggestedName ) => {
384382 const result = await dialog . showSaveDialog ( this . window , {
385383 defaultPath : path . join ( settings . lastDirectory , suggestedName ) ,
386384 filters : [
@@ -423,14 +421,14 @@ class EditorWindow extends ProjectRunningWindow {
423421 } ;
424422 } ) ;
425423
426- ipc . handle ( 'get-preferred-media-devices' , ( ) => {
424+ this . ipc . handle ( 'get-preferred-media-devices' , ( ) => {
427425 return {
428426 microphone : settings . microphone ,
429427 camera : settings . camera
430428 } ;
431429 } ) ;
432430
433- ipc . on ( 'start-write-stream' , async ( startEvent , id ) => {
431+ this . ipc . on ( 'start-write-stream' , async ( startEvent , id ) => {
434432 const file = getFileById ( id ) ;
435433 if ( file . type !== TYPE_FILE ) {
436434 throw new Error ( 'Not a file' ) ;
@@ -503,39 +501,39 @@ class EditorWindow extends ProjectRunningWindow {
503501 port . start ( ) ;
504502 } ) ;
505503
506- ipc . on ( 'alert' , ( event , message ) => {
504+ this . ipc . on ( 'alert' , ( event , message ) => {
507505 event . returnValue = prompts . alert ( this . window , message ) ;
508506 } ) ;
509507
510- ipc . on ( 'confirm' , ( event , message ) => {
508+ this . ipc . on ( 'confirm' , ( event , message ) => {
511509 event . returnValue = prompts . confirm ( this . window , message ) ;
512510 } ) ;
513511
514- ipc . handle ( 'open-packager' , ( ) => {
512+ this . ipc . handle ( 'open-packager' , ( ) => {
515513 PackagerWindow . forEditor ( this ) ;
516514 } ) ;
517515
518- ipc . handle ( 'open-new-window' , ( ) => {
516+ this . ipc . handle ( 'open-new-window' , ( ) => {
519517 EditorWindow . newWindow ( ) ;
520518 } ) ;
521519
522- ipc . handle ( 'open-addon-settings' , ( event , search ) => {
520+ this . ipc . handle ( 'open-addon-settings' , ( event , search ) => {
523521 AddonsWindow . show ( search ) ;
524522 } ) ;
525523
526- ipc . handle ( 'open-desktop-settings' , ( ) => {
524+ this . ipc . handle ( 'open-desktop-settings' , ( ) => {
527525 DesktopSettingsWindow . show ( ) ;
528526 } ) ;
529527
530- ipc . handle ( 'open-privacy' , ( ) => {
528+ this . ipc . handle ( 'open-privacy' , ( ) => {
531529 PrivacyWindow . show ( ) ;
532530 } ) ;
533531
534- ipc . handle ( 'open-about' , ( ) => {
532+ this . ipc . handle ( 'open-about' , ( ) => {
535533 AboutWindow . show ( ) ;
536534 } ) ;
537535
538- ipc . handle ( 'get-advanced-customizations' , async ( ) => {
536+ this . ipc . handle ( 'get-advanced-customizations' , async ( ) => {
539537 const USERSCRIPT_PATH = path . join ( app . getPath ( 'userData' ) , 'userscript.js' ) ;
540538 const USERSTYLE_PATH = path . join ( app . getPath ( 'userData' ) , 'userstyle.css' ) ;
541539
@@ -550,7 +548,7 @@ class EditorWindow extends ProjectRunningWindow {
550548 } ;
551549 } ) ;
552550
553- ipc . handle ( 'check-drag-and-drop-path' , ( event , filePath ) => {
551+ this . ipc . handle ( 'check-drag-and-drop-path' , ( event , filePath ) => {
554552 FileAccessWindow . check ( filePath ) ;
555553 } ) ;
556554
@@ -560,7 +558,7 @@ class EditorWindow extends ProjectRunningWindow {
560558 */
561559 this . isInEditorFullScreen = false ;
562560
563- ipc . handle ( 'set-is-full-screen' , ( event , isFullScreen ) => {
561+ this . ipc . handle ( 'set-is-full-screen' , ( event , isFullScreen ) => {
564562 this . isInEditorFullScreen = ! ! isFullScreen ;
565563 } ) ;
566564
@@ -590,7 +588,7 @@ class EditorWindow extends ProjectRunningWindow {
590588 enumerateMediaDevices ( ) {
591589 // Used by desktop settings
592590 return new Promise ( ( resolve , reject ) => {
593- this . window . webContents . ipc . once ( 'enumerated-media-devices' , ( event , result ) => {
591+ this . ipc . once ( 'enumerated-media-devices' , ( event , result ) => {
594592 if ( typeof result . error !== 'undefined' ) {
595593 reject ( result . error ) ;
596594 } else {
0 commit comments