@@ -84,41 +84,34 @@ const newCreateElement = <K extends keyof HTMLElementTagNameMap>(tagName: K): HT
84
84
document . createElement = newCreateElement ;
85
85
86
86
class Clipboard {
87
-
88
87
public has ( ) : boolean {
89
88
return false ;
90
89
}
91
90
92
91
public writeText ( value : string ) : Promise < void > {
93
92
return clipboard . writeText ( value ) ;
94
93
}
95
-
96
94
}
97
95
98
96
class Shell {
99
-
100
97
public async moveItemToTrash ( path : string ) : Promise < void > {
101
98
await promisify ( exec ) (
102
99
`trash-put --trash-dir ${ escapePath ( "~/.Trash" ) } ${ escapePath ( path ) } ` ,
103
100
) ;
104
101
}
105
-
106
102
}
107
103
108
104
class App extends EventEmitter {
109
-
110
105
public isAccessibilitySupportEnabled ( ) : boolean {
111
106
return false ;
112
107
}
113
108
114
109
public setAsDefaultProtocolClient ( ) : void {
115
110
throw new Error ( "not implemented" ) ;
116
111
}
117
-
118
112
}
119
113
120
114
class Dialog {
121
-
122
115
public showSaveDialog ( _ : void , options : Electron . SaveDialogOptions , callback : ( filename : string | undefined ) => void ) : void {
123
116
const defaultPath = options . defaultPath || "/untitled" ;
124
117
const fileIndex = defaultPath . lastIndexOf ( "/" ) ;
@@ -203,11 +196,9 @@ class Dialog {
203
196
} ) ;
204
197
dialog . show ( ) ;
205
198
}
206
-
207
199
}
208
200
209
201
class WebFrame {
210
-
211
202
public getZoomFactor ( ) : number {
212
203
return 1 ;
213
204
}
@@ -219,19 +210,15 @@ class WebFrame {
219
210
public setZoomLevel ( ) : void {
220
211
// Nothing.
221
212
}
222
-
223
213
}
224
214
225
215
class Screen {
226
-
227
216
public getAllDisplays ( ) : [ ] {
228
217
return [ ] ;
229
218
}
230
-
231
219
}
232
220
233
221
class WebRequest extends EventEmitter {
234
-
235
222
public onBeforeRequest ( ) : void {
236
223
throw new Error ( "not implemented" ) ;
237
224
}
@@ -243,28 +230,22 @@ class WebRequest extends EventEmitter {
243
230
public onHeadersReceived ( ) : void {
244
231
throw new Error ( "not implemented" ) ;
245
232
}
246
-
247
233
}
248
234
249
235
class Session extends EventEmitter {
250
-
251
236
public webRequest = new WebRequest ( ) ;
252
237
253
238
public resolveProxy ( url : string , callback : ( proxy : string ) => void ) : void {
254
239
// TODO: not sure what this actually does.
255
240
callback ( url ) ;
256
241
}
257
-
258
242
}
259
243
260
244
class WebContents extends EventEmitter {
261
-
262
245
public session = new Session ( ) ;
263
-
264
246
}
265
247
266
248
class BrowserWindow extends EventEmitter {
267
-
268
249
public webContents = new WebContents ( ) ;
269
250
private representedFilename : string = "" ;
270
251
@@ -323,15 +304,13 @@ class BrowserWindow extends EventEmitter {
323
304
public setTitle ( value : string ) : void {
324
305
document . title = value ;
325
306
}
326
-
327
307
}
328
308
329
309
/**
330
310
* We won't be able to do a 1 to 1 fill because things like moveItemToTrash for
331
311
* example returns a boolean while we need a promise.
332
312
*/
333
313
class ElectronFill {
334
-
335
314
public readonly shell = new Shell ( ) ;
336
315
public readonly clipboard = new Clipboard ( ) ;
337
316
public readonly app = new App ( ) ;
@@ -382,7 +361,6 @@ class ElectronFill {
382
361
} ;
383
362
}
384
363
// tslint:enable no-any
385
-
386
364
}
387
365
388
366
module . exports = new ElectronFill ( ) ;
0 commit comments