File tree Expand file tree Collapse file tree 1 file changed +4
-17
lines changed
Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change 11import querystring from "querystring" ;
22import urlParser from "url" ;
3- import { webFrame } from "electron" ;
3+ import { contextBridge } from "electron" ;
44
55declare function atob ( b64 : string ) : string ;
66
7- interface Env {
8- [ key : string ] : string ;
9- }
10-
11- interface Itch {
12- env : Env ;
13- args : string [ ] ;
14- }
15-
16- type ExtendedGlobal = typeof global & {
17- Itch : Itch ;
18- } ;
19- const extendedGlobal = global as ExtendedGlobal ;
20-
217( function ( ) {
228 try {
239 console . log (
@@ -42,9 +28,10 @@ const extendedGlobal = global as ExtendedGlobal;
4228 const jsonSource = atob (
4329 Array . isArray ( itchObjectBase64 ) ? itchObjectBase64 [ 0 ] : itchObjectBase64
4430 ) ;
45- extendedGlobal . Itch = JSON . parse ( jsonSource ) ;
31+ const itchObject = JSON . parse ( jsonSource ) ;
32+ contextBridge . exposeInMainWorld ( "Itch" , itchObject ) ;
4633 console . log ( "Loaded itch environment!" ) ;
47- console . dir ( extendedGlobal . Itch ) ;
34+ console . dir ( itchObject ) ;
4835 } catch ( e ) {
4936 console . error ( "While loading itch environment: " , e ) ;
5037 } finally {
You can’t perform that action at this time.
0 commit comments