當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。