1- // Type definitions for Electron 3.1.0
1+ // Type definitions for Electron 3.1.2
22// Project: http://electronjs.org/
33// Definitions by: The Electron Team <https://github.com/electron/electron>
44// Definitions: https://github.com/electron/electron-typescript-definitions
@@ -2794,7 +2794,9 @@ declare namespace Electron {
27942794 * registered shortcut is pressed by the user. When the accelerator is already
27952795 * taken by other applications, this call will silently fail. This behavior is
27962796 * intended by operating systems, since they don't want applications to fight for
2797- * global shortcuts.
2797+ * global shortcuts. The following accelerators will not be registered successfully
2798+ * on macOS 10.14 Mojave unless the app has been authorized as a trusted
2799+ * accessibility client:
27982800 */
27992801 register ( accelerator : Accelerator , callback : Function ) : void ;
28002802 /**
@@ -6307,14 +6309,14 @@ declare namespace Electron {
63076309 * connection is made to the server, but before any http data is sent. The callback
63086310 * has to be called with an response object.
63096311 */
6310- onBeforeSendHeaders ( filter : OnBeforeSendHeadersFilter , listener : Function ) : void ;
6312+ onBeforeSendHeaders ( filter : OnBeforeSendHeadersFilter , listener : ( details : OnBeforeSendHeadersDetails , callback : ( response : OnBeforeSendHeadersResponse ) => void ) => void ) : void ;
63116313 /**
63126314 * The listener will be called with listener(details, callback) before sending an
63136315 * HTTP request, once the request headers are available. This may occur after a TCP
63146316 * connection is made to the server, but before any http data is sent. The callback
63156317 * has to be called with an response object.
63166318 */
6317- onBeforeSendHeaders ( listener : Function ) : void ;
6319+ onBeforeSendHeaders ( listener : ( details : OnBeforeSendHeadersDetails , callback : ( response : OnBeforeSendHeadersResponse ) => void ) => void ) : void ;
63186320 /**
63196321 * The listener will be called with listener(details) when a request is completed.
63206322 */
@@ -6336,13 +6338,13 @@ declare namespace Electron {
63366338 * headers of a request have been received. The callback has to be called with an
63376339 * response object.
63386340 */
6339- onHeadersReceived ( filter : OnHeadersReceivedFilter , listener : Function ) : void ;
6341+ onHeadersReceived ( filter : OnHeadersReceivedFilter , listener : ( details : OnHeadersReceivedDetails , callback : ( response : OnHeadersReceivedResponse ) => void ) => void ) : void ;
63406342 /**
63416343 * The listener will be called with listener(details, callback) when HTTP response
63426344 * headers of a request have been received. The callback has to be called with an
63436345 * response object.
63446346 */
6345- onHeadersReceived ( listener : Function ) : void ;
6347+ onHeadersReceived ( listener : ( details : OnHeadersReceivedDetails , callback : ( response : OnHeadersReceivedResponse ) => void ) => void ) : void ;
63466348 /**
63476349 * The listener will be called with listener(details) when first byte of the
63486350 * response body is received. For HTTP requests, this means that the status line
@@ -8054,6 +8056,16 @@ declare namespace Electron {
80548056 urls : string [ ] ;
80558057 }
80568058
8059+ interface OnBeforeSendHeadersDetails {
8060+ id : number ;
8061+ url : string ;
8062+ method : string ;
8063+ webContentsId ?: number ;
8064+ resourceType : string ;
8065+ timestamp : number ;
8066+ requestHeaders : RequestHeaders ;
8067+ }
8068+
80578069 interface OnBeforeSendHeadersFilter {
80588070 /**
80598071 * Array of URL patterns that will be used to filter out the requests that do not
@@ -8062,6 +8074,14 @@ declare namespace Electron {
80628074 urls : string [ ] ;
80638075 }
80648076
8077+ interface OnBeforeSendHeadersResponse {
8078+ cancel ?: boolean ;
8079+ /**
8080+ * When provided, request will be made with these headers.
8081+ */
8082+ requestHeaders ?: RequestHeaders ;
8083+ }
8084+
80658085 interface OnCompletedDetails {
80668086 id : number ;
80678087 url : string ;
@@ -8105,6 +8125,18 @@ declare namespace Electron {
81058125 urls : string [ ] ;
81068126 }
81078127
8128+ interface OnHeadersReceivedDetails {
8129+ id : number ;
8130+ url : string ;
8131+ method : string ;
8132+ webContentsId ?: number ;
8133+ resourceType : string ;
8134+ timestamp : number ;
8135+ statusLine : string ;
8136+ statusCode : number ;
8137+ responseHeaders : ResponseHeaders ;
8138+ }
8139+
81088140 interface OnHeadersReceivedFilter {
81098141 /**
81108142 * Array of URL patterns that will be used to filter out the requests that do not
@@ -8113,6 +8145,19 @@ declare namespace Electron {
81138145 urls : string [ ] ;
81148146 }
81158147
8148+ interface OnHeadersReceivedResponse {
8149+ cancel : boolean ;
8150+ /**
8151+ * When provided, the server is assumed to have responded with these headers.
8152+ */
8153+ responseHeaders ?: ResponseHeaders ;
8154+ /**
8155+ * Should be provided when overriding responseHeaders to change header status
8156+ * otherwise original response header's status will be used.
8157+ */
8158+ statusLine ?: string ;
8159+ }
8160+
81168161 interface OnResponseStartedDetails {
81178162 id : number ;
81188163 url : string ;
0 commit comments