mirror of
https://github.com/TangentFoxy/memex.git
synced 2024-11-22 04:54:23 +00:00
Add write test to IPC test.
This commit is contained in:
parent
711192d1d1
commit
dd9aac0721
@ -2236,11 +2236,21 @@ ON ICONS
|
|||||||
LINK : https://ia.net/topics/on-icons
|
LINK : https://ia.net/topics/on-icons
|
||||||
PERS : rutherford
|
PERS : rutherford
|
||||||
SRCE : Merveilles
|
SRCE : Merveilles
|
||||||
|
TAGS : design
|
||||||
|
|
||||||
TURBO
|
TURBO
|
||||||
|
DATE : 12018-08-05
|
||||||
|
TYPE : term
|
||||||
|
TAGS : car
|
||||||
TERM
|
TERM
|
||||||
> Turbo: compressor forcing additional air into an engine to allow for increased fuel ignition and thus increased power output. A turbo has two halves, one is driven by the exhaust from the engine the other forces air into the engine. Negative 'turbo lag' time until the engine can provide enough exhaust to spin up the turbo compressor.
|
> Turbo: compressor forcing additional air into an engine to allow for increased fuel ignition and thus increased power output. A turbo has two halves, one is driven by the exhaust from the engine the other forces air into the engine. Negative 'turbo lag' time until the engine can provide enough exhaust to spin up the turbo compressor.
|
||||||
> Supercharger: Like a turbo but instead of being driven by exhaust gas it is driven mechanically (belt to engine). Negative Takes power/efficiency away from driving engine output in order to drive the compressor.
|
> Supercharger: Like a turbo but instead of being driven by exhaust gas it is driven mechanically (belt to engine). Negative Takes power/efficiency away from driving engine output in order to drive the compressor.
|
||||||
> Electic supercharger: fully electronically driven turbo (generally powered by a higher voltage (48v) seperate from car 12v). Negative high electricity use.
|
> Electic supercharger: fully electronically driven turbo (generally powered by a higher voltage (48v) seperate from car 12v). Negative high electricity use.
|
||||||
> Electic turbo: a hybrid electric-assisted turbo (generally powered by a higher voltage (48v) seperate from car 12v) using a DC motor to start the turbo spinning sooner to remove turbo lag or at low revs when not enough exhaust to produced. Once the engine is providing enough exhaust to spin the turbo the motor will stop output. It can also be a seperate electric supercharger working in conjunction with a standard turbo. Negative complexity.
|
> Electic turbo: a hybrid electric-assisted turbo (generally powered by a higher voltage (48v) seperate from car 12v) using a DC motor to start the turbo spinning sooner to remove turbo lag or at low revs when not enough exhaust to produced. Once the engine is providing enough exhaust to spin the turbo the motor will stop output. It can also be a seperate electric supercharger working in conjunction with a standard turbo. Negative complexity.
|
||||||
|
|
||||||
|
ELECTRON IPC
|
||||||
|
DATE : 12018-08-06
|
||||||
|
LINK : https://ourcodeworld.com/articles/read/537/how-to-execute-a-function-of-the-main-process-inside-the-renderer-process-in-electron-framework
|
||||||
|
PROJ : Memex
|
||||||
|
TAGS : web, code
|
||||||
`
|
`
|
@ -94,15 +94,8 @@ function Add()
|
|||||||
document.getElementById("enter").addEventListener('click',
|
document.getElementById("enter").addEventListener('click',
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
console.log('test test');
|
console.log('called write');
|
||||||
// ipcRenderer.send('write', 'test');
|
ipcRenderer.send('write', '<br>'+this.display.innerHTML);
|
||||||
let Data =
|
|
||||||
{
|
|
||||||
message: "Hi",
|
|
||||||
someData: "Let's go"
|
|
||||||
};
|
|
||||||
|
|
||||||
ipcRenderer.send('request-mainprocess-action', Data);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var i = 0; i < this.keys.length; i++)
|
for (var i = 0; i < this.keys.length; i++)
|
||||||
|
46
main.js
46
main.js
@ -3,6 +3,7 @@ const path = require('path')
|
|||||||
const url = require('url')
|
const url = require('url')
|
||||||
const shell = require('electron').shell;
|
const shell = require('electron').shell;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const { ipcMain } = require('electron');
|
||||||
|
|
||||||
let is_shown = true;
|
let is_shown = true;
|
||||||
|
|
||||||
@ -54,24 +55,6 @@ app.on('ready', () =>
|
|||||||
}, width: 950, height: 950, backgroundColor:"#ddd", minWidth: 587, minHeight: 540, frame:true, autoHideMenuBar: true, icon: __dirname + '/icon.ico'})
|
}, width: 950, height: 950, backgroundColor:"#ddd", minWidth: 587, minHeight: 540, frame:true, autoHideMenuBar: true, icon: __dirname + '/icon.ico'})
|
||||||
|
|
||||||
app.win.loadURL(`file://${__dirname}/docs/index.html`);
|
app.win.loadURL(`file://${__dirname}/docs/index.html`);
|
||||||
|
|
||||||
// app.win.webContents.on('did-finish-load', () => {
|
|
||||||
// let code = `
|
|
||||||
// console.log("3");
|
|
||||||
// document.getElementById("enter").addEventListener("click",
|
|
||||||
// function (e)
|
|
||||||
// {
|
|
||||||
// let foo = fs.openSync('foo.txt','r+');
|
|
||||||
// let buf = new Buffer("hello");
|
|
||||||
// fs.writeSync(foo, buf, 0, buf.length, 5);
|
|
||||||
// fs.close(foo);
|
|
||||||
// console.log('WROTE!');
|
|
||||||
|
|
||||||
// console.log(document.getElementById("display").value);
|
|
||||||
// });`;
|
|
||||||
// app.win.webContents.executeJavaScript(code);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// app.win.toggleDevTools();
|
// app.win.toggleDevTools();
|
||||||
|
|
||||||
app.win.on('closed', () => {
|
app.win.on('closed', () => {
|
||||||
@ -109,25 +92,12 @@ app.on('activate', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// write = function(data)
|
ipcMain.on('write', (event, arg) =>
|
||||||
// {
|
{
|
||||||
// let foo = fs.openSync('foo.txt','r+');
|
console.log('Write called! Entry = ' + arg);
|
||||||
// let buf = new Buffer("hello");
|
|
||||||
// fs.writeSync(foo, buf, 0, buf.length, 5);
|
|
||||||
// fs.close(foo);
|
|
||||||
// console.log('WROTE!');
|
|
||||||
// }
|
|
||||||
|
|
||||||
const {ipcMain} = require('electron');
|
let foo = fs.openSync('foo.txt','r+');
|
||||||
|
let buf = new Buffer(arg);
|
||||||
// Attach listener in the main process with the given ID
|
fs.writeSync(foo, buf, 0, buf.length, 5);
|
||||||
ipcMain.on('request-mainprocess-action', (event, arg) => {
|
fs.close(foo);
|
||||||
// Displays the object sent from the renderer process:
|
|
||||||
//{
|
|
||||||
// message: "Hi",
|
|
||||||
// someData: "Let's go"
|
|
||||||
//}
|
|
||||||
console.log(
|
|
||||||
arg
|
|
||||||
);
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user