$ git clone https://github.com/electron/electron-api-demos
$ cd electron-api-demos
$ npm install
$ npm start
$ npx electron --interactive
> const electron = require('electron');
> const win = new electron.BrowserWindow({width: 800, height: 600});
> win.loadURL('https://m.naver.com');
not available on Windows :-(
=> Self-executable electron app
TODO: github 예제에 electron-builder 설정 추가할 것
PROJECT_ROOT
├─node_modules
└─src
├─client
├─electron
└─server
PROJECT_ROOT
├─node_modules
└─output
├─client
├─electron
└─server.exe
TODO: translate
1. Check for update
2. Download
3. Set local feed url
4. Download Update
Client - Electron - Server
TunnelClient - TunnelBridge - TunnelServer
export class CommandHistory {
@CallbackApi
public undo(): void {
}
@ListenerApi
public on(eventType: string, callback: Function): void {
}
}
const commandHistory = new CommandHistory();
virtualApi.addService('history', commandHistory);
const server = new VirtualApiClient(tunnelClient);
$("#undo_btn").on("click", () => server.history.undo());
Command
Event Listeners + Query APIs
Model
UI
UI
UI
Model
export class Layer {
@Watch
x = 0;
@Watch
y = 0;
}
server.command("layer_edit", layerId, {x: 10, y:20});
server.layers.on('change', (layer, prop, newValue, oldValue) => {
this.element.style.left = layer.x + 'px';
this.element.style.top = layer.y + 'px';
});
export class CommandHistory {
@CallbackApi
undo() { ... }
@CallbackApi
redo() { ... }
@ListenerApi
on(eventType, callback) { ... }
}
this.apiServer.addService('history', new CommandHistory(context));
server.history.on('undostackchange', (undoCount, redoCount) => {
...
});
server.history.undo();
TODO: Add diagram