electron/atom/renderer/api/lib/ipc-renderer.js

28 lines
771 B
JavaScript
Raw Normal View History

2016-01-14 22:11:50 +00:00
const binding = process.atomBinding('ipc');
const v8Util = process.atomBinding('v8_util');
2016-01-12 02:40:23 +00:00
2016-01-14 22:11:50 +00:00
var slice = [].slice;
2016-01-12 02:40:23 +00:00
2016-01-14 18:35:29 +00:00
// Created by init.coffee.
2016-01-14 22:11:50 +00:00
const ipcRenderer = v8Util.getHiddenValue(global, 'ipc');
2016-01-12 02:40:23 +00:00
ipcRenderer.send = function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return binding.send('ipc-message', slice.call(args));
};
ipcRenderer.sendSync = function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return JSON.parse(binding.sendSync('ipc-message-sync', slice.call(args)));
};
ipcRenderer.sendToHost = function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return binding.send('ipc-message-host', slice.call(args));
};
module.exports = ipcRenderer;