当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ipcMain.on方法代码示例

本文整理汇总了TypeScript中electron.ipcMain.on方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ipcMain.on方法的具体用法?TypeScript ipcMain.on怎么用?TypeScript ipcMain.on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron.ipcMain的用法示例。


在下文中一共展示了ipcMain.on方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: BrowserWindow

export = (mainWindow) => {
    let newFileWindow: Electron.BrowserWindow;
    ipcMain.on('new-file', () => {
        newFileWindow = new BrowserWindow({
            width: 500,
            height: 300,
            modal: true,
            parent: mainWindow,
            minimizable: false,
            resizable: false,
            show: false
        });

        newFileWindow.loadURL(`file://${__dirname}/../../resources/views/newFile.html`);
        newFileWindow.setMenu(null);
        newFileWindow.on('ready-to-show', () => {
            newFileWindow.show();
        });

        newFileWindow.on('closed', function () {
            newFileWindow = null;
        });
    });

    // Close the file window when the 'OK' button is pressed
    ipcMain.on('new-file-create', (event, settings) => {
        mainWindow.webContents.send('new-file', settings);
        if (newFileWindow) {
            newFileWindow.close();
        }
    });
}
开发者ID:TheColorRed,项目名称:photo-editor,代码行数:32,代码来源:new.ts

示例2: createWindow

function createWindow() {
  mainWindow = new BrowserWindow({height: 650, width: 900, show: debug});
  if (debug) {
    mainWindow.webContents.openDevTools();
  }
  mainWindow.loadURL(`file://${__dirname}/index.html`);
  if (process.platform === 'darwin') {
    Menu.setApplicationMenu(createMenu());
  } else {
    mainWindow.setMenu(createMenu());
  }
  ipcMain.once('+main:angular-up', () => {
    if (debug) {
      mainWindow.webContents.send('+view:debug-enabled');
    }
    if (startFile) {
      openScheduleFromFile(startFile);
    }
    mainWindow.show();
  });
  ipcMain.on('+main:new-schedule', () => {
    createNewSchedule();
  });
  ipcMain.on('+main:open-schedule', () => {
    openScheduleFileDialog();
  });
  mainWindow.on('closed', () => {
    mainWindow = null;
    app.quit();
  });
};
开发者ID:molisani,项目名称:fcp-schedule,代码行数:31,代码来源:electron-main.ts

示例3: constructor

 constructor() {
   if (PresentationWindow.instance) throw new Error('must use the getInstance.');
   electron.ipcMain.on(EVENTS.PRESENTATION_WINDOW.RENDERER.REQUEST_START_PRESENTATION, this.hanldRequestStartPresentation.bind( this ) );
   electron.ipcMain.on(EVENTS.PRESENTATION_WINDOW.RENDERER.REQUEST_MESSAGE, (ev) => {
     ev.returnValue = this.text;
   });
 };
开发者ID:richardy2012,项目名称:cafe-pitch,代码行数:7,代码来源:presentation_window.ts

示例4: openWin

function openWin(serverConf?:any) {
    ipcMain.on('open-devtool', (event:any, status:any) => {
        win.toggleDevTools({mode: 'detach'});
    });

    ipcMain.on('devWatch', (event:any, arg:any) => {
        sender = event.sender;
        devWatch();
    });

    win = new BrowserWindow({
        width: 950, height: 540,
        // width: 500, height: 540,
        resizable: false,
        frame: true,
        autoHideMenuBar: false,
        webaudio: false
    });
    // win.setMenu(null);
    win.setMenuBarVisibility(false);
    // win.loadURL('http://127.0.0.1');
    if (isDev)
        win.loadURL(`file://${__dirname}app/reload.html`);
    else
        win.loadURL(`file:///resources/app/reload.html`);
    // win.loadURL(`file:///app/reload.html`);
    win.on('closed', function () {
        win = null;
    });

    
    //todo print
    // http://electron.atom.io/docs/api/web-contents/
}
开发者ID:solpie,项目名称:yqbe,代码行数:34,代码来源:main.ts

示例5: ready

	public ready(): void {
		ipcMain.on('app:reloadWindow', () => {
            this.window.reload();
        });

        ipcMain.on('app:toggleDevTools', () => {
            this.window.webContents.openDevTools();
        });
	}
开发者ID:f111fei,项目名称:react-demo,代码行数:9,代码来源:ipc.ts

示例6: wakeup

 wakeup(sender: Electron.WebContents) {
     this.sender = sender;
     ipc.on('shiba:notify-path', (_: any, new_path: string) => {
         this.setWatchingPath(new_path);
     });
     ipc.on('shiba:request-path', () => {
         this.sender.send('shiba:return-path', this.watching_path);
     });
     this.linter = new Linter(this.sender, this.config.linter, this.config.lint_options);
 }
开发者ID:Sheshouzuo,项目名称:Shiba,代码行数:10,代码来源:watcher.ts

示例7: constructor

    constructor() {
        this.windows = [];

        Electron.ipcMain.on('createCheckoutWindow', (event, args) => {
            this.createCheckoutWindow(args.payload, args.settings, args.serviceUrl);
        });
        Electron.ipcMain.on('getCheckoutState', (event, args) => {
            let state = event.sender['checkoutState'];
            event.returnValue = state;
        });
    }
开发者ID:sarthakfx,项目名称:BotFramework-Emulator,代码行数:11,代码来源:windowManager.ts

示例8: bindListeners

    public static bindListeners():void {
        ipcMain.on("open-input-directory-dialog", (event: Electron.IpcMessageEvent) => {
                dialog.showOpenDialog({
                    properties: ["openDirectory"]
                }, function (dirs:string[]) {
                    if (dirs) {
                        event.sender.send("selected-input-directory", dirs[0]);
                    }
                });
            }
        );

        ipcMain.on("open-output-directory-dialog", (event: Electron.IpcMessageEvent) => {
                dialog.showOpenDialog({
                    properties: ["openDirectory"]
                }, function (dirs:string[]) {
                    if (dirs) {
                        event.sender.send("selected-output-directory", dirs[0]);
                    }
                });
            }
        );

        ipcMain.on("restart", () => {
            autoUpdater.quitAndInstall();
        });

        ipcMain.on("save-languages", (event: Electron.IpcMessageEvent, languages: any) => {
            console.log("Saving languages");
            var folder = app.getPath("userData");
            var file = join(folder, "languages.json");

            writeFile(file, JSON.stringify(languages), {encoding: "utf8"}, function(err) {
                err && console.error(err);
                console.log("Saved languages.");
            });
        });

        ipcMain.on("get-languages", (event: Electron.IpcMessageEvent) => {
            var folder = app.getPath("userData");
            var file = join(folder, "languages.json");

            readFile(file, "utf8", function(err, data) {
                if(err) {
                    event.sender.send("got-languages", "{}");
                    return console.error(err);
                }

                event.sender.send("got-languages", JSON.parse(data));
            });
        });
    }
开发者ID:zlepper,项目名称:go-modpack-packer,代码行数:52,代码来源:IpcHandlers.ts

示例9:

export const runAutoUpdaterService = (window: BrowserWindow) => {
  autoUpdater.on('update-downloaded', ({ version }) => {
    window.webContents.send(UPDATE_AVAILABLE, version);
  });

  ipcMain.on(UPDATE_RESTART_AND_INSTALL, () => {
    autoUpdater.quitAndInstall();
  });

  ipcMain.on(UPDATE_CHECK, () => {
    if (process.env.ENV !== 'dev') {
      autoUpdater.checkForUpdates();
    }
  });
};
开发者ID:laquereric,项目名称:wexond,代码行数:15,代码来源:auto-updater.ts

示例10:

const checkForUpdate = () => {
  if (EnvironmentUtil.platform.IS_WINDOWS) {
    Squirrel.handleSquirrelEvent(isFirstInstance);

    ipcMain.on(EVENT_TYPE.WRAPPER.UPDATE, () => Squirrel.installUpdate());
  }
};
开发者ID:wireapp,项目名称:wire-desktop,代码行数:7,代码来源:lifecycle.ts


注:本文中的electron.ipcMain.on方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。