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


TypeScript ipcRenderer.sendSync方法代码示例

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


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

示例1: do_ping

	do_ping() {
		if (this.has_ipc) {
			console.log(ipcRenderer.sendSync('synchronous-message', 'sync ping')); // prints "pong"
			ipcRenderer.send('asynchronous-message', 'async ping');
		} else {
			console.log("There isn't Electron main process.");
		}
	}
开发者ID:aracen74,项目名称:tsng2,代码行数:8,代码来源:homepage.component.ts

示例2: Player

process.once('loaded', () => {
  let themeConfig = ipcRenderer.sendSync('get-theme-settings');
  let themeSettings: BowtiePlist = themeConfig && themeConfig.settings ? themeConfig.settings : {};
  let player = new Player(themeSettings);
  let bowtie = new Bowtie();
  global.iTunes = player;
  global.Player = player;
  global.Bowtie = bowtie;
  global.onload = () => {
    global.document.body.addEventListener('contextmenu', (e) => {
      e.preventDefault();
      menu.popup(remote.getCurrentWindow());
    });
    global.document.body.addEventListener('mousewheel', (e) => {
      e.preventDefault();
      handleScroll(e);
    });
  };
  ipcRenderer.on('error', (...args) => {
    handleError('Unknown', args);
  });
});
开发者ID:ryan-nauman,项目名称:spotify-mini,代码行数:22,代码来源:preload.ts

示例3: BrowserWindow

import {
	ipcRenderer,
	remote,
	webFrame,
	clipboard,
	crashReporter,
	nativeImage,
	screen,
	shell
} from 'electron';

import * as fs from 'fs';

// In renderer process (web page).
// https://github.com/atom/electron/blob/master/docs/api/ipc-renderer.md
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')); // prints "pong"

ipcRenderer.on('asynchronous-reply', (event: Electron.IpcRendererEvent, arg: any) => {
	console.log(arg); // prints "pong"
	event.sender.send('another-message', 'Hello World!');
});

ipcRenderer.send('asynchronous-message', 'ping');

// remote
// https://github.com/atom/electron/blob/master/docs/api/remote.md

var BrowserWindow = remote.BrowserWindow;
var win = new BrowserWindow({ width: 800, height: 600 });
win.loadURL('https://github.com');
开发者ID:longlho,项目名称:DefinitelyTyped,代码行数:30,代码来源:github-electron-renderer-tests.ts

示例4: startGame

import {Module} from 'vuex'
import {IRootState} from '../index'
import {IRunningGame} from '../../../main/service/game'
import {ipcRenderer} from 'electron'


export interface IProcessState {
  processes: IRunningGame[]
}

const store: Module<IProcessState, IRootState> = {
  namespaced: true,
  state: {
    processes: ipcRenderer.sendSync('game:running'),
  },
  mutations: {
    startGame(state, {name, json, id}) {
      state.processes.push({
        name, json, id, launcher: null,
      })
    },
    onGameStop(state, {id}) {
      const index = state.processes.findIndex((value) => {
        if (value.id === id) return true
      })
      if (index === -1) return
      state.processes.splice(index, 1)
    }
  },
}
开发者ID:bangbang93,项目名称:BMCLJS,代码行数:30,代码来源:process.ts

示例5: sendWillQuitSync

export function sendWillQuitSync() {
  // eslint-disable-next-line no-sync
  ipcRenderer.sendSync('will-quit')
}
开发者ID:Ahskys,项目名称:desktop,代码行数:4,代码来源:main-process-proxy.ts

示例6: platform

export const bootstrapElectronRenderer = () => {
  electron.ipcRenderer.sendSync(ELECTRON_READY);
  platform([WORKER_RENDER_PLATFORM]).application([WORKER_RENDER_APPLICATION])
}
开发者ID:micaelgallego,项目名称:electron-node-java,代码行数:4,代码来源:electron_renderer.ts

示例7: ngOnInit

 ngOnInit() {
   this.slideServie.setText(ipcRenderer.sendSync('RequestPrintText'));
   this.pages = _.range(1, this.slideServie.getMaxPage() + 1);
 }
开发者ID:richardy2012,项目名称:cafe-pitch,代码行数:4,代码来源:export.component.ts

示例8:

import { ipcRenderer } from "electron";

interface IElectron {
	electron: {
		ipc: Electron.IpcRenderer
		app: {
			version: string
			userDataPath: string
		}
	}
}

const w: any = window
const obj: IElectron = {
	electron: {
		ipc: ipcRenderer,
		app: {
			version: ipcRenderer.sendSync('pitboom', 'get-app-version'),
			userDataPath: ipcRenderer.sendSync('pitboom', 'get-app-user-data-path'),
		},
	}
}
w.electron = obj.electron
开发者ID:omenansiemen,项目名称:pitboom-app,代码行数:23,代码来源:index.ts


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