mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Convert preload.js to Typescript so that it gets copied to lib
where we expect it
This commit is contained in:
parent
0143b4b114
commit
d353c68a75
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const { ipcRenderer, desktopCapturer, contextBridge } = require('electron');
|
||||
import { ipcRenderer, desktopCapturer, contextBridge, IpcRendererEvent, SourcesOptions } from 'electron';
|
||||
|
||||
// Expose only expected IPC wrapper APIs to the renderer process to avoid
|
||||
// handing out generalised messaging access.
|
||||
@ -39,21 +39,21 @@ const CHANNELS = [
|
||||
contextBridge.exposeInMainWorld(
|
||||
"electron",
|
||||
{
|
||||
on(channel, listener) {
|
||||
on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void) {
|
||||
if (!CHANNELS.includes(channel)) {
|
||||
console.error(`Unknown IPC channel ${channel} ignored`);
|
||||
return;
|
||||
}
|
||||
ipcRenderer.on(channel, listener);
|
||||
},
|
||||
send(channel, ...args) {
|
||||
send(channel: string, ...args: any[]) {
|
||||
if (!CHANNELS.includes(channel)) {
|
||||
console.error(`Unknown IPC channel ${channel} ignored`);
|
||||
return;
|
||||
}
|
||||
ipcRenderer.send(channel, ...args);
|
||||
},
|
||||
async getDesktopCapturerSources(options) {
|
||||
async getDesktopCapturerSources(options: SourcesOptions) {
|
||||
const sources = await desktopCapturer.getSources(options);
|
||||
const desktopCapturerSources = [];
|
||||
|
Loading…
Reference in New Issue
Block a user