forked from electron/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: tsify more of lib (electron#23721)
* chore: tsify more of lib * Update lib/browser/api/session.ts Co-authored-by: Jeremy Apthorp <jeremya@chromium.org> Co-authored-by: Jeremy Apthorp <jeremya@chromium.org>
- Loading branch information
1 parent
762f7bc
commit 9bc5e98
Showing
25 changed files
with
66 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
lib/browser/api/browser-view.js → lib/browser/api/browser-view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
'use strict'; | ||
import { EventEmitter } from 'events'; | ||
|
||
const { EventEmitter } = require('events'); | ||
const { BrowserView } = process.electronBinding('browser_view'); | ||
|
||
Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype); | ||
|
||
BrowserView.fromWebContents = (webContents) => { | ||
BrowserView.fromWebContents = (webContents: Electron.WebContents) => { | ||
for (const view of BrowserView.getAllViews()) { | ||
if (view.webContents.equal(webContents)) return view; | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
module.exports = BrowserView; | ||
export default BrowserView; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default process.electronBinding('content_tracing'); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default process.electronBinding('global_shortcut').globalShortcut; |
16 changes: 9 additions & 7 deletions
16
lib/browser/api/in-app-purchase.js → lib/browser/api/in-app-purchase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
'use strict'; | ||
import { EventEmitter } from 'events'; | ||
|
||
const { deprecate } = require('electron'); | ||
let _inAppPurchase; | ||
|
||
if (process.platform === 'darwin') { | ||
const { EventEmitter } = require('events'); | ||
const { inAppPurchase, InAppPurchase } = process.electronBinding('in_app_purchase'); | ||
|
||
// inAppPurchase is an EventEmitter. | ||
Object.setPrototypeOf(InAppPurchase.prototype, EventEmitter.prototype); | ||
EventEmitter.call(inAppPurchase); | ||
|
||
module.exports = inAppPurchase; | ||
_inAppPurchase = inAppPurchase; | ||
} else { | ||
module.exports = { | ||
purchaseProduct: (productID, quantity, callback) => { | ||
_inAppPurchase = new EventEmitter(); | ||
Object.assign(_inAppPurchase, { | ||
purchaseProduct: () => { | ||
throw new Error('The inAppPurchase module can only be used on macOS'); | ||
}, | ||
canMakePayments: () => false, | ||
getReceiptURL: () => '' | ||
}; | ||
}); | ||
} | ||
|
||
export default _inAppPurchase; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const { Notification: ElectronNotification, isSupported } = process.electronBinding('notification'); | ||
|
||
ElectronNotification.isSupported = isSupported; | ||
|
||
export default ElectronNotification; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default process.electronBinding('power_save_blocker').powerSaveBlocker; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { fromPartition } = process.electronBinding('session'); | ||
|
||
export default { | ||
fromPartition, | ||
get defaultSession () { | ||
return fromPartition(''); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use strict'; | ||
|
||
const { Tray } = process.electronBinding('tray'); | ||
|
||
module.exports = Tray; | ||
export default Tray; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use strict'; | ||
|
||
const { View } = process.electronBinding('view'); | ||
|
||
module.exports = View; | ||
export default View; |
5 changes: 2 additions & 3 deletions
5
lib/browser/api/views/image-view.js → lib/browser/api/views/image-view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
const electron = require('electron'); | ||
import { View } from 'electron'; | ||
|
||
const { View } = electron; | ||
const { ImageView } = process.electronBinding('image_view'); | ||
|
||
Object.setPrototypeOf(ImageView.prototype, View.prototype); | ||
|
||
module.exports = ImageView; | ||
export default ImageView; |
7 changes: 2 additions & 5 deletions
7
lib/browser/api/web-contents-view.js → lib/browser/api/web-contents-view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
'use strict'; | ||
import { View } from 'electron'; | ||
|
||
const electron = require('electron'); | ||
|
||
const { View } = electron; | ||
const { WebContentsView } = process.electronBinding('web_contents_view'); | ||
|
||
Object.setPrototypeOf(WebContentsView.prototype, View.prototype); | ||
|
||
module.exports = WebContentsView; | ||
export default WebContentsView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
lib/common/api/native-image.js → lib/common/api/native-image.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use strict'; | ||
|
||
const { nativeImage } = process.electronBinding('native_image'); | ||
|
||
module.exports = nativeImage; | ||
export default nativeImage; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default process.electronBinding('shell'); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters