-å¿
èŠãªããšãå®è¡ã§ããã¢ããªã±ãŒã·ã§ã³ãå¿
èŠã§ãã æ®å¿µãªããšã§ã¯ãããŸããã
ããªãèªåã§æžããŠã¿ãŸãããïŒã
-ããã¯å°é£ã§ããçè«ãç解ããå®è·µãå§ããã®ã«å€ãã®æéãããããŸãã äžè¬çã«ãç§ã¯ããã³ããšã³ãéçºè
ã§ãããHTMLãCSSãJSã«æ
£ããŠããŸãã ãã®ã¹ã¿ãã¯ã§ã¯ããã¹ã¯ãããã¢ããªã±ãŒã·ã§ã³ãäœæã§ããŸããã
-é»åïŒ
ç§ãã¡ã®ã»ãšãã©ãã¹ã¯ãªãŒã³ã·ã§ãããå ±æããŠãããšç¢ºä¿¡ããŠããŸãã ã¹ã¯ãªãŒã³ã·ã§ãããæ®ããäœããã®æ¹æ³ã§ããããç·šéïŒã¯ããããæç»ãªã©ïŒã§ããã¢ããªã±ãŒã·ã§ã³ãå€æ°ãããŸãã ç§ã®é ã«æµ®ãã¶æåã®3ã€ïŒJoxyãMonosnapãGyazoã
ã¿ã¹ã¯ãšããŒã«ãããã°ãããã«äœã欲ããã§ããããïŒ ãããããããããã»ã©åçŽã§ã¯ãããŸããã
ã¢ããªã±ãŒã·ã§ã³ãæ€çŽ¢ããåºæº
ãµãŒããŒã«ã¹ã¯ãªãŒã³ã·ã§ãããä¿åãã
ã¢ããªã±ãŒã·ã§ã³ãç»åãä¿åããå Žæãæ¢ããŠæ·»ä»ããããããã¹ã¯ãªãŒã³ã·ã§ãããžã®ãªã³ã¯ãããããããæ¹ãã¯ããã«äŸ¿å©ã§ãã ãã¡ãããã©ããã§ã¹ã¯ãªãŒã³ã·ã§ãããä¿åããããšã奜ãŸãªã人ãããŸãã ããããäžæ¹ã§ãããã«ãããåé¡ããã°ãã解決ã§ããŸã-ã¹ã¯ãªãŒã³ã·ã§ãããå ±æããŸãã ãã®ã¢ããªã±ãŒã·ã§ã³ã®åäœã¢ãã«ã¯ç§ã«ãŽã£ããã§ãã
ã¹ã¯ãªãŒã³ã·ã§ããã®æç»
ç§èªèº«ã®çµéšãããã»ãšãã©ãã¹ãŠã®ã¹ã¯ãªãŒã³ã·ã§ããã«ç¢å°ããããšèšããŸãã ãããã¯...ã®éã«ããããšãããããªããšãæžãããããããã€ãã®è©³çŽ°ãæãæ¹ãã¯ããã«ç°¡åã§ãã ãŸããç§ã®æèŠã§ã¯ãã¹ã¯ãªãŒã³ã·ã§ããã®æç»ããŒã«ã®æšæºã»ããã«éçãé·æ¹åœ¢ãããã¹ããå«ããå¿ èŠããããŸãã åæã«ãæç»ããèŠçŽ ã移åãå転ãåé€ããæ©èœãå¿ èŠã§ãã
LinuxããŒãžã§ã³
çµå±ã®ãšãããLinuxã§ã®ãã®ã¿ã¹ã¯ã«ã¯å€ãã®ã¢ããªã±ãŒã·ã§ã³ã¯ååšããŸããã é·ãéãGyazoã䜿çšããŠããŸããããã¹ã¯ãªãŒã³ã·ã§ããã§ãç飯åšãã®è²»çšãæ¯æãå¿ èŠããªããã°ãGyazoãããã«äœ¿çšããŠããŸããã
ç®±ããåºããŠ
ã¢ããªã±ãŒã·ã§ã³ã¯å¿ èŠã«å¿ããŠããã«åäœããã¯ãã§ãã äœãèšå®ããããããããçš®é¡ã®Imgurã«ç»é²ãããããå¿ èŠã¯ãããŸãããã¹ã¯ãªãŒã³ã·ã§ããããã£ããã£ããæ¯ããããä¿åãããªã³ã¯ãå ±æãããã ãã§ãã
幎éãéããŠå®æçã«æ€çŽ¢ããŸããããæçµçã«èªåã®èŠä»¶ãæºããã¢ããªã±ãŒã·ã§ã³ãèŠã€ãããŸããã§ããã
é»å
æéãçµã¡ãç§ã¯åœŒãåççã«ç¥ã£ãŠããããšãç解ããããã«ããè¿ãElectronãç¥ãããšã«ããã ç¥ããªã人ã®ããã«ãElectronã¯ãHTMLãCSSãããã³JavaScriptã䜿çšããŠãã¹ã¯ãããã¢ããªã±ãŒã·ã§ã³ãäœæã§ãããã¯ãããžãŒã§ãã
ãŸãããã¢ã®1ã€ã§ã¯ããŠãŒã¶ãŒã®ç»é¢ã®ã¹ã¯ãªãŒã³ã·ã§ãããååŸããæ¹æ³ã瀺ããŸããã ããã¯æ¬¡ã®ããšãæå³ããŠããŸããã
- æçµçã«ç§ã®èŠä»¶ãæºããã¢ããªã±ãŒã·ã§ã³ãäœæã§ããŸãã
- å®éã®ãããžã§ã¯ãã§æ°ãããã¯ãããžãŒã«æ £ããæ©äŒ
ã©ããžãã©ãããå§ããŠãã©ã®ããã«æ©èœããã
ç§ã¯äœãæ°ããããšãåŠã³ãããšæããã³ã«ãããã®è³ªåãèªåããŸãã å€ãã®å Žåã解決çã¯åãã§ã-ããã¥ã¡ã³ããšäœããã®å ¬åŒã®ãã¯ããã«ãã Electronã¯äž¡æ¹ãšãããŸããã£ãŠããŸãã å°ãªããšã圌ãã¯ãããžã§ã¯ãã®ãŠã§ããµã€ãã«ãã®ããã«æžããŠããŸã-ãããªããæã£ãŠããããç°¡åã§ããã æ¬åœã«ããã§ãïŒ ããã«ç解ããå¿ èŠãããã®ã¯ãã¢ããªã±ãŒã·ã§ã³ãã¡ã€ã³ãšã¬ã³ãã©ãŒã®2ã€ã®ããã»ã¹ã§æ§æãããŠããããšã ãã§ãã Mainã§ã¯ãã¢ããªã±ãŒã·ã§ã³ãŠã£ã³ããŠãã¡ãã¥ãŒãªã©ãæäœããŸããRendererã§ã¯ãåºæ¬çã«ããŒãžã®ã¿ããããŸãã
ã¢ããªã±ãŒã·ã§ã³ãéå§ããå Žæ
ãŸãã次ã®æ§é ãæã€ãããžã§ã¯ããäœæããŸãããã
-ããã±ãŒãžãjson
-main.js
-ã¹ã¯ãªãã
-renderer.js
ãããããããã§ååã§ãã main.jsã«ã¯ãã¡ã€ã³ããã»ã¹ã«é¢é£ããã³ãŒããããã³ã¹ã¯ãªãã-> renderer.jsã¬ã³ããªã³ã°ãå«ãŸããŸãã 次ã«ãã¢ããªã±ãŒã·ã§ã³èªäœãäœæããå¿ èŠããããŸãã ãããè¡ãã«ã¯ãmain.jsã«æ¬¡ã®ããã«èšè¿°ããŸãã
const electron = require('electron'); const app = electron.app; app.on('ready', () => { createWindow(); }); app.on('window-all-closed', function() { app.quit(); });
æåŸã«äœãããŸãããïŒ Electronãæ¥ç¶ããã¢ããªã±ãŒã·ã§ã³èªäœãäœæãã2ã€ã®ãã³ãã©ãŒã«ã€ããŠèª¬æããŸããã ã¢ããªã±ãŒã·ã§ã³ã®æºåãã§ããããé¢æ°ãåŒã³åºããŠæ°ãããŠã£ã³ããŠãäœæããŸãã ãããŠããã¹ãŠã®ãŠã£ã³ããŠãéããããç¬éã«-ã¢ããªã±ãŒã·ã§ã³ããã»ã¹ãçµäºããŸãã
çª
ããŠãããã§ç³è«ããã»ã¹èªäœãã§ããŸããã 次ã«ã圌ã®ããã«ãŠã£ã³ããŠãäœæããããšæããŸãã createWindowïŒïŒ;ãšåŒã°ããããšãèŠããŠããŸããïŒ ã ãã圌女ã説æããæãæ¥ãŸããã
function createWindow() { appWindow = new BrowserWindow({ width: 300, height: 300 }); };
次ã®æ¥ç¶ãå¿ èŠã§ãã
const BrowserWindow = electron.BrowserWindow;
ãããã£ãŠãæå®ããã寞æ³ã®ãŠã£ã³ããŠãäœæããŸããã ãšãŠãç°¡åã§ãããïŒ
ãŠã£ã³ããŠã«ã¯ãå€ãã®ããããã£ãã¡ãœãããã€ãã³ããé¢é£ä»ããããŠããŸãã äŸïŒã¿ã€ãã«ãã¢ã€ã³ã³ãxãyã衚瀺ïŒïŒãé衚瀺ïŒïŒãéããïŒïŒãæå°åãéããã埩å ããµã€ãºå€æŽã ãªã¹ãå šäœããªã¹ãããã®ã¯åœ¹ã«ç«ããªãã®ã§ãããã«ãã©ãŠã¶WIndowãžã®ãªã³ã¯ããããŸãã
ãããã空ã®ãŠã£ã³ããŠãèŠãããšã¯ããŸã楜ãããããŸããããïŒ ã¿ã€ãã«ãHelloãworldïŒããå«ãç°¡åãªããŒãžãã¢ããããŒãããŸãããã main.js
ã®ã¬ãã«ã§ã <h1>Hello, World!</h1>
ãŠæãäžè¬çãªããŒãžã®ããã«èŠããindex.htmlãã¡ã€ã«ãäœæããŸãã ããšã¯ãcreateWindowïŒïŒé¢æ°ãè¿œå ããŠã
appWindow.loadURL(`file://${__dirname}/index.html`);
ã¢ããªã±ãŒã·ã§ã³ãèµ·åããŠã以äžã確èªããŸãã
ã¡ãã£ãšããéæ³:)ããããã¡ãã£ãšæ²ããããšã«ã€ããŠã
ãããã°ãã
ããããå®éã«ãšã©ãŒããã£ããããæ¹æ³ã¯ïŒ ãã¹ãŠãå¯èœãªéãã·ã³ãã«ã§ãïŒ ãšã©ãŒãã¡ã€ã³ããã»ã¹ã«ããå Žåãã¢ããªã±ãŒã·ã§ã³ãèµ·åããã³ã³ãœãŒã«ã§ãšã©ãŒãçºçããŸãã ããŒãžèªäœã®ãšã©ãŒããã£ããããã«ã¯ããã©ãŠã¶ã³ã³ãœãŒã«ã䜿çšããŸãã ã¯ãããŸãã«ïŒ ç§ãã¡ã®ã¢ããªã±ãŒã·ã§ã³ã¯ãå®éã«ã¯ãã©ãŠã¶ãŒã§å®è¡ãããŠããããŒãžã§ãã ã³ã³ãœãŒã«ãæå¹ã«ããã«ã¯ã createWindow();
è¿œå ããŸãããcreateWindow();
è¡ïŒ appWindow.webContents.openDevTools();
ã ã¢ããªã±ãŒã·ã§ã³ãèµ·åãããšãããã«ã³ã³ãœãŒã«ã衚瀺ãããŸãã
ã¡ãã¥ãŒ
ãããŸã§ã®ãšããããŠã£ã³ããŠå ã®ããŒãžã®ã¿ãååŸãããŸããã ããšãã°ãã¡ãã¥ãŒã䜿çšããŠãäœããã®åœ¢ã§åœŒå¥³ãšããåãããããšæããŸãã ãã®ãããElectronã«ã¯ç¹å¥ãªã¡ãã¥ãŒã¯ã©ã¹ããããŸãã ã¿ã¹ã¯ãèšå®ããŸã-1ã€ã®èŠçŽ ããã¡ãã¥ãŒãäœæããã«ã¯ãã¯ãªãã¯ãããšãHelloããšããã¿ã€ãã«ã®ã·ã¹ãã ãããã¢ãããŠã£ã³ããŠã衚瀺ãããŸãããDo you like thisïŒããšããã¡ãã»ãŒãžã衚瀺ããããªãã·ã§ã³['Yes'ã 'No']ã«çããŸãã
main.jsã«æ¬¡ã®ããã«èšè¿°ããŸãã
const appMenu = require('./scripts/appMenu');
ãããŠãscriptsãã£ã¬ã¯ããªã«appMenu.jsãã¡ã€ã«ãäœæããŸãã ãã®äžã«ã¯ã次ã®ã³ãŒããå«ãŸããŠããŸãã
const { shell } = require('electron'); const dialog = require('electron').dialog; const newShotDialog = { type: 'info', title: 'Hello', message: 'Do you like this?', buttons: ['Yes', 'No'] }; module.exports = function appMenu(app, appWindow) { return ( [ { label: 'File', submenu: [ { label: 'Click me', click() { dialog.showMessageBox(newShotDialog, function(index) { }) }, }, ], }, ] ); };
ããã«é²ã¿ãŸãã app.on('ready'...
è¿œå ïŒ
const template = appMenu(app, appWindow); const menu = electron.Menu.buildFromTemplate(template); electron.Menu.setApplicationMenu(menu);
ã¢ããªã±ãŒã·ã§ã³ãèµ·åãããšãã¡ãã¥ãŒãå°ãããªãã1ã€ã®èŠçŽ ãå«ãŸããããã«ãªããŸãã ã¯ãªãã¯ãããšã次ã®ããã«è¡šç€ºãããŸãã
å®éã«ãã¿ã¹ã¯ã解決ããŸããã èšäºå šäœãããã€ãã®æœè±¡çãªã¢ããªã±ãŒã·ã§ã³ïŒãªãŒãã£ãªãã¬ãŒã€ãŒãªã©ïŒã®äœæã«å ãŠãããšãã§ããŸãããããã¯ãã¹ãŠãäœããã®ã³ãŒãã->ãçµæãã§æ§æãããŸããã¿ããéããŠã圌èªèº«ã®ãã®ãæžãã«è¡ããŸããïŒã ãããã£ãŠããã®èšäºã®æ®ãã®éšåã§ã¯ãç§ã®--shotsãããžã§ã¯ãã®äŸã䜿çšããŠãããã€ãã®éèŠãªãElectronæ©èœã®æŠèŠã«å°å¿µããŸãã å¿é ããªãã§ãäžèšã®ã¢ããªã±ãŒã·ã§ã³ã¯ã«ãããŸãã
--shotsãäŸã«ãããããå€ãã®Electronæ©èœ
åæããŸããé »ç¹ã«äœ¿çšããããŒã«ïŒäœç©ãç¢å°ãªã©ïŒãæ¯åã¡ãã¥ãŒã«ç§»åããããšã¯ããŸã䟿å©ã§ã¯ãããŸããã ãã®åé¡ã¯ãããŒãžãé 眮ããããŒãžã®é åã«ããã«ãäœæããããšã§è§£æ±ºã§ããŸãã æ¢ã«ãã䟿å©ã§ããïŒããã°ãã¡ãã¥ãŒãæ©ãå¿ èŠã¯ãããŸããïŒãããã§ãå®ç§ã§ã¯ãããŸããïŒæãå·®ã䌞ã¹ãå¿ èŠããããŸãïŒã
ãã£ãšããã ãããïŒ
ãã¡ããã§ããŸãïŒ ã³ã³ããã¹ãã¡ãã¥ãŒã䜿çšããŸãããã ãŠã£ã³ããŠé åãå³ã¯ãªãã¯ããŠåŒã³åºãããŸãã ãã®ãããªã¡ãã¥ãŒã¯é ç®ã§æ§æãããåé ç®ãæŒããšãç¬èªã®æ©èœãåŒã³åºãããŸãã ããšãã°ããã®ã¡ãã¥ãŒã«æ¬¡ã®èŠçŽ ãé 眮ããŸããã
- æ°ããã·ã§ãã
- ä¿åãã
- ããã©ã«ã
- åãæã
- ç¢å°
- é·æ¹åœ¢
- ãã³
- ãŒãã
ãã®ããŒã«ã»ããã¯ãã¢ããªã±ãŒã·ã§ã³ã®ã»ãŒãã¹ãŠã®æ©èœãå©çšããŸãã
ãããšããã£ãšè¯ãã§ããïŒ
ã¯ããã¢ããªã±ãŒã·ã§ã³æ©èœãžã®ã¢ã¯ã»ã¹ãããã«ç°¡çŽ åã§ããŸãã ãããããŒã䜿çšããŠãããå®çŸããŸãã ãããããŒã¯ãglobalShortcutã¢ãžã¥ãŒã«ãšregisterã¡ãœããã䜿çšããŠç»é²ãããŸãã ç°ãªããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®ããŒããŒãã®éããèŠããŠããå¿
èŠããããŸãã ããšãã°ãLinuxããã³Windowsã§Commandããªãã¹ã³ããããšã¯åœ¹ã«ç«ã¡ãŸããã ãããã£ãŠãElectronã®éçºè
ã¯CommandOrControlãèãããšããå§ãããŸãã
æšæºã®å Žåã®ãããããŒã¯ã修食åïŒCommandOrControlãAltãOption ...ïŒãšããŒã³ãŒãïŒ0-9ãA-ZãSpaceãTab ...ïŒã§æ§æãããŸãã 2ã€ã®ããŒã®çµã¿åããã§æ§æãããå¿
èŠã¯ãªãããšã«æ³šæããŠãã ããã 1ã€ãŸãã¯3ã€ïŒãããããã以äžã§ããããã§ãã¯ããŠããŸããïŒããããŸãã ããšãã°ããããããŒã®ãªã¹ãã§ã¢ãŒãã«ãŠã£ã³ããŠã䜿çšããã«ã¯ãF2ã䜿çšãããºãŒã ïŒãºãŒã ã€ã³ïŒ CommandOrControl+shift+Plus
ãå¢ããããã«äœ¿çšããŸãã ããã§ãªããã°ã CommandOrControl+shift+Plus
çµã¿åãããontrol+shift+=
å€æãããããããã®ãã§ãŒã³ã«shiftãè¿œå ããå¿
èŠããããŸããã
ããã»ã¹éä¿¡
ã»ãšãã©ã®å Žåãããããã»ã¹ããå¥ã®ããã»ã¹ã«ã¡ãã»ãŒãžã転éããå¿
èŠããããŸãïŒããšãã°ããã®ãããªé¢æ°ããã®ãããªé¢æ°ãåŒã³åºããŠãã ããïŒã ããã«ã¯ipcRendererãšipcMainããããŸãã åçŽãªã¿ã¹ã¯ãèšå®ããŠããããã©ã®ããã«æ©èœããããèŠã€ããŸãã ã¡ãã¥ãŒã®é
ç®ãã¯ãªãã¯ãããšãã¢ã©ãŒããåºãç¹å®ã®é¢æ°ãåŒã³åºããããšããŸãã ã¯ãªãã¯ãã³ãã©ãŒã§ã¯ã appWindow.webContents.send('show');
ãããªãã®ãèšè¿°ããŸãappWindow.webContents.send('show');
ã ããã¯æ¬¡ãæå³ããŸããã¬ã³ãã©ãŒããã»ã¹ã§ã¡ãã¥ãŒé
ç®ãã¯ãªãã¯ãããšããshowããã£ãã«ãä»ããŠéåæã¡ãã»ãŒãžãéä¿¡ãããŸãã è¿œå ã®åŒæ°ãæž¡ãããšãã§ããã®ã§ãã¢ã©ãŒãã«ãæž¡ãããåŒæ°ãåºåãããŸãã 以åã«äœæããappWindow.webContents.send('show', 'content');
ããããã«å€æŽãappWindow.webContents.send('show', 'content');
ã
ã¬ã³ãã©ãŒããã»ã¹ã§ã¯æ¬¡ã®ããã«èšè¿°ããŸãã
ipcRenderer.on('show', (event, message) => { alert(message) // Alerts 'content' });
ã芧ã®ãšããããã¹ãŠãéåžžã«ç°¡åã§ãïŒ
ãã¬ã€
ã¢ããªã±ãŒã·ã§ã³ãæå°åããããŸãŸãã³ã°ã¢ããããªãããšãããã«æªãããšã«ãåã«éããŠããããšã䟿å©ã§ãã ãã®åé¡ã解決ãããã¬ã€ããããŸãã ãããŠElectronã¯ããã¬ã€ã¯ã©ã¹ãéããŠåœŒãšäžç·ã«ä»äºãããããšãå¯èœã«ããŸãã
åºæ¬çã«ãã¬ã€ã¢ããªã±ãŒã·ã§ã³ãšã¯äœã§ããïŒ ããã¯ãå³ã¯ãªãã¯ã§åŒã³åºãããã¢ã€ã³ã³ãšã¡ãã¥ãŒã§ãã Trayã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ãŒã¯ãã¢ã€ã³ã³ãšãããã©ã¡ãŒã¿ãŒã1ã€ã ãåãå
¥ããããšã«æ³šæããŠãã ããã ãã®ãã©ã¡ãŒã¿ãŒãæ¬ èœããŠããå Žåããšã©ãŒãã¹ããŒãããŸãã æåã¯ãããã¯ãŸã£ããé©ããŸããã§ããã ã³ã³ã¹ãã©ã¯ã¿ãŒã«ã¯å¿
é ãã©ã¡ãŒã¿ãŒããããŸã;芪å-ãããæž¡ããŸãã å°ãåŸã§ããã®ãã©ã¡ãŒã¿ãŒã®ãã€ã³ããå°æ¥çã«å¥åŠã«æããçç±ã説æããŸãã
ã¢ããªã±ãŒã·ã§ã³ã¢ã€ã³ã³
è£
食ã«ã€ããŠããå°ã話ããŸãããã ã¢ããªã±ãŒã·ã§ã³ã¯ã¢ã€ã³ã³ãªãã§ã©ã®ããã«åäœããŸããïŒïŒ ããã¯ãæ°ãããŠã£ã³ããŠãäœæããã®ãšåãå Žæã«è¿œå ãããæåŸã«ã¢ã€ã³ã³ãè¿œå ããŸãïŒ__dirname + '/icon.png'ã Windowsã§ã¯ã* .ico圢åŒã®ã¢ã€ã³ã³ã䜿çšããããšããå§ãããŸãã os.platform()
䜿çšã§ãããããæããããŸããã
ç§ã®ããŒãžã¯ã·ã¹ãã ã«å°éã§ããŸããïŒ
ã¯ãããã¡ããã§ãã ãã®èšäºã®å·çæç¹ã§ã¯ãElectronã®çŸåšã®ããŒãžã§ã³ã¯1.4.6ã§ãããNodeJS 6.5ã§åäœããŸãã ããšãã°ã-shotsã«ã¯ããã¡ã€ã«ãããŒã«ã«ã«ä¿åããæ©èœããããŸãã ããã«ã¯fs.writeFile
ã䜿çšãfs.writeFile
ã ãããŠããã®ãããªä¿åã®åã«æ¯åãã¹ã¯ãªãŒã³ã·ã§ããçšã®ãã£ã¬ã¯ããªããããã©ããã確èªããŸãïŒã--shotsããšåŒã³ãŸãïŒã ååšããªãå Žåã¯ãäœæããŸãã
Electronã¢ããªã±ãŒã·ã§ã³ã¯ãæšæºãŠã£ã³ããŠã®åãªãããŒãžã§ã¯ãªããæ¬æ Œçãªã¢ããªã±ãŒã·ã§ã³ã§ããããšãç解ããããšã¯éåžžã«éèŠã§ãã
--shotsã«ãªãè¿œå æ©èœ
åœç¶ã-shotsã«åãçµãã§ããéãElectronã®ãã¹ãŠã®æ©èœã䜿çšããŸããã§ããã
ããšãã°ãã¢ããªã±ãŒã·ã§ã³ãAppStoreããã³WindowsStoreã«ã¢ããããŒãã§ããŸãã ãããã-shotsã¯LInuxã®ã¢ããªã±ãŒã·ã§ã³ãšããŠèããããŠããã®ã§ãã¢ããªã±ãŒã·ã§ã³ãå
¬éãããšãããã®ãžã£ã³ã°ã«ã®ãã¹ãŠã«å®éã«ã¯è§ŠããŸããã§ããã ããããã¢ããªã±ãŒã·ã§ã³ãAppStoreã«é
眮ããã«ã¯ã眲åããå¿
èŠãããããšãç¥ã£ãŠããŸãã --shotsã®æ°ããããŒãžã§ã³ãäœæãããã³ã«ãã³ã³ãœãŒã«ã«ãã®èŠåã衚瀺ãããå°æ¥çã«äœã圱é¿ãåãŒããªãããã«æã亀差ãããŸãã
ãŸããElectronã®Webãµã€ãã§ãèªåæŽæ°ããšãããã°ãããã¢ã€ãã ãèŠã€ããããšãã§ããŸãã ããããç§ã¯ããã--shotsã«çµã³ã€ããããšãã§ããŸããã§ããããªããªãã èšäºãéããŠèŠãïŒ
ãLinuxã«ã¯èªåã¢ããããŒã¿ã®ãµããŒããçµã¿èŸŒãŸããŠããªãããããã£ã¹ããªãã¥ãŒã·ã§ã³ã®ããã±ãŒãžãããŒãžã£ãŒã䜿çšããŠã¢ããªãæŽæ°ããããšããå§ãããŸããã
ç°¡åã«èšãã°ãLInuxã§ã¯æ©èœããŸããã ã ããåºãŠã ããšãã°ããµãŒããŒã«èŠæ±ãéä¿¡ãããšãçŸåšã®çŸåšã®ããŒãžã§ã³ã®çªå·ãè¿ãããã¢ããªã±ãŒã·ã§ã³ã®ããŒãžã§ã³ãšäžèŽããªãå Žåã¯ãæŽæ°ãæ±ããã¡ãã»ãŒãžã衚瀺ãããŸãã
èœãšãç©Ž
ãã¹ãŠãã¯ãŒã«ã«èãããŸããããã£ãããå¿ èŠã§ãã ãã¡ãããããã€ãã®äžå¿«ãªç¬éããããŸãïŒ
ãã¹ãŠãã¯ãã¹ãã©ãããã©ãŒã ã§ã¯ãªã
ããã¯ãåãèªåæŽæ°ã®äŸã§ãé¡èã§ãã éæãªãŠã£ã³ããŠã§ããããã»ã©åçŽã§ã¯ãããŸããã ããšãã°ãLinuxã§ã¯ãã³ãã³ãã©ã€ã³ã§--enable-transparent-visuals --disable-gpu
ãå®è¡ããå¿
èŠããããŸããããããªããšãéæãªãŠã£ã³ããŠã衚瀺ãããŸããã åæããŠãã€ã³ã¹ããŒã«åŸã«ãŠãŒã¶ãŒã«ç«¯æ«ã«äœããé転ããããã«èŠæ±ããã¢ããªã±ãŒã·ã§ã³ã¯ããã§ã«çããæèµ·ãå§ããŠããŸãã
æå°å
ããã§åé¡ã解決ããã®ã«å€ãã®æéãè²»ãããŸããã ãã®æ¬è³ªã¯æ¬¡ã®ãšããã§ããã¢ããªã±ãŒã·ã§ã³ãŠã£ã³ããŠãæå°åãããšãæå°åã€ãã³ããçºçãããŠã£ã³ããŠãæå°åãããŸãã ãã¹ãŠã倧äžå€«ã®ããã§ãã ããããã¢ããªã±ãŒã·ã§ã³ã¯ããã¬ã€ãšããã¯ã«ã¶ãäžãã£ãŠããŸã-ããã¯ãã§ã«å¥åŠã§ãã ãããã£ãŠãæå°åããã£ããããäœããã®æ¹æ³ã§ã¢ããªã±ãŒã·ã§ã³ãããã¯ããåé€ããŠããã¬ã€ã«ã®ã¿æ®ããããšæããŸãã ããã«ã¯hideïŒïŒã¡ãœããããããŸãã æå°åãããã³ãã©ãäœæããhideãåŒã³åºããŸãããã¹ãŠåé¡ãããŸããã 次ã«ããã¬ã€ã¡ãã¥ãŒããã¢ããªã±ãŒã·ã§ã³ãå±éããæ©èœãè¿œå ãããã£ãã®ã§ãããããã«showïŒïŒã¡ãœãããèŠã€ãããŸããã ãã¹ãŠã¯è«ççãªè¡šç€º/é衚瀺ã§ããããããã§ãã ãã¬ã€ããã¢ããªã±ãŒã·ã§ã³ããããã€ããããšãããšããã£ãããšãã³ã°ããŸãã éåžžã«é·ãéãç§ã¯éèŠãªãã®ãæ¬ ããŠãããšæã£ãŠããŸããããã³ã³ãœãŒã«ã«ãšã©ãŒã¯è¡šç€ºãããŸããã§ããã ç¹ã«ãshowïŒïŒãåŒã³åºãåã«ãŠã£ã³ããŠèªäœã衚瀺ãããŸãã-ãŠã£ã³ããŠãååšããŸãã äžè¬ã«ãã¢ããªã±ãŒã·ã§ã³ã®åæ§ã®ã¡ã«ããºã ãæåŠããã¢ããªã±ãŒã·ã§ã³ãŠã£ã³ããŠãéããŠãããšãã«hideïŒïŒãåŒã³åºãããšã決å®ããŸããã ãããŠãã¯ããå¥è·¡ãèµ·ãããŸããã ãã¹ãŠãæ£ããæ©èœããŸããã 質åãžã®çããæ¢ãã®ã«æ°æéãè²»ãããŸããïŒããªãä»äºãããŸãããïŒããããŠãæçµçã«ããã¬ã°ã©ã ã¯ç§ã«è§£æ±ºçãä¿ããŸããã ã¡ãã¥ãŒã«ããã¬ã€ã«æå°åããããšããé ç®ãè¿œå ããåæã«ãããããŒãè¿œå ããŸããã
äžè¬çã«ãç§ã«ãšã£ãŠElectronã®èœãšãç©Žã¯çµãããŸããã ãããããç§ã¯å¹žéã ã£ã...
çµç«
ã¢ã»ã³ããªãšãããããã²ãšã€ã®èå³æ·±ãããšã«ã€ããŠè©±ãæãæ¥ãŸããã Electronã¯ãã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããŸããŸãªãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã«ã€ã³ã¹ããŒã«ããæ©äŒãæäŸããŸãã ãŠãŒã¶ãŒã¯ãWebãã¯ãããžãŒã§ã¢ããªã±ãŒã·ã§ã³ãäœæããããšã«æ°ä»ããªãããšããããŸãã ããå§ããŸãããïŒ
æšæºçãªã¢ãããŒã
ããã¥ã¡ã³ãã»ã¯ã·ã§ã³ã®å ¬åŒWebãµã€ãã«ã¯ãã¢ã»ã³ããªæé ïŒLinuxãMacOSãWINDOWSïŒãžã®3ã€ã®ãªã³ã¯ããããŸãã ãã®ã¢ããªã±ãŒã·ã§ã³ã¯å ã Linuxã§ç£šãããŠããã®ã§ãæåã«ãªã³ã¯ãéããŸããã æåã®ã·ã¹ãã èŠä»¶ã¯ããã«ç§ãé©ãããŸããïŒãå°ãªããšã25GBã®ãã£ã¹ã¯ã¹ããŒã¹ãš8GBã®RAMãïŒå°ãªããšã25GBã®ç©ºãã¹ããŒã¹ãš8GBã®RAMïŒã ãããããŸãããç§ã¯äœãã§ããŸããïŒãç§ã¯èããŠãäŸããã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããšãå§ããŸããã ãã®çµæãã¢ã»ã³ããªããã»ã¹èªäœã«20ã30åããããŸãããããã«ãã³ã³ãã¥ãŒã¿ãŒã䜿çšããããšã¯äžå¯èœã§ããã ç§ã¯ãã®ã³ã¬ã¯ã¿ãŒã§åãç¶ããªãã£ãããšãéåžžã«ããããæããŸãã 1ã€ã®äžå¿«ãªããšã«ã€ããŠåŠã³ãŸããããã軞ã®äžã§ã¢ããªã±ãŒã·ã§ã³ãçµã¿ç«ãŠãã«ã¯ããã®è»žã®äžããæ£ç¢ºã«çµã¿ç«ãŠãå¿ èŠããããŸãã
ãå¥ã®æ¹æ³ãããã¯ãã§ãããšç§ã¯èªåã«èšããŸããã ãããŠãã¯ããããã¯ååšããŸãã
é»åãã«ããŒ
ãé»åãã«ããŒããã°ãŒã°ã«ã§æ€çŽ¢ããæåã®ãªã³ã¯ããã©ãã ãã§ååã§ããã ãã以æ¥ãç§ã¯ãã®ã³ã¬ã¯ã¿ãŒã䜿çšããŠããŸããããã®çç±ã¯æ¬¡ã®ãšããã§ãã
- ã¢ã»ã³ããª-Linuxã®ã·ã§ããã«ã¯çŽ1åããããŸãããã
- Linuxãã.exe-shnikããã«ãããããšãã§ããŸãïŒWineãã€ã³ã¹ããŒã«ããå¿ èŠããããŸããã倧äžå€«ã§ãïŒã
- çµã¿ç«ãŠããã»ã¹äžã«ããŒã ãèŠãããšãã§ããŸãããäœãé ããªããŸããã
æ®ã£ãŠããã®ã¯ããããžã§ã¯ããæ£ããè£è¶³ããããšã ãã§ãã
ãããžã§ã¯ãã®æºå
ãã®ããã»ã¹ã¯2段éã«åããããšãã§ããŸãã
- ã¢ã€ã³ã³ã®æºå
- package.jsonãæºåããŠããŸãã
ã¢ã€ã³ã³
ã¢ããªã±ãŒã·ã§ã³ãã€ã³ã¹ããŒã«ãããšãç¬èªã®ã¢ã€ã³ã³ãå¿ èŠã«ãªããŸãã ãããè¡ãã«ã¯ããããžã§ã¯ãã®ã«ãŒããã£ã¬ã¯ããªã«ãbuildããã£ã¬ã¯ããªãäœæããå¿ èŠããããŸãããã®ãã£ã¬ã¯ããªã¯æ¬¡ã®ããã«å ¥åã§ããŸãã
-ãã«ã
-ã¢ã€ã³ã³
âââ 32x32.png
âââ 32x32.png.ico
-icon.icns
-icon.ico
Package.json
ãããžã§ã¯ãããã«ãããããšãããšãã³ã³ãœãŒã«ãããšã©ãŒãçºçãå§ããŸãã ããã¯ããã¡ã€ã«ã«æšæºè¡ãå«ãŸããŠããå¿ èŠãããããã§ãã
- ååã
- 説æã
- ããŒãžã§ã³ã
- èè ã
次ã«ãããã«ãããšãã¹ã¯ãªããããèšè¿°ããå¿ èŠããããŸãã ç§ã¯æå³çã«ãããã®2ã€ã®ãã€ã³ãããã°ãã調ã¹ãŸããã å éšã«ãããã®ãèŠããŠããå¿ èŠã¯ãããŸãããç¹ã«ãïŒããã«ããçšã®ïŒèšå€§ãªæ°ã®èšå®ããããšèããå Žåã¯ã»ãšãã©äžå¯èœã§ãã ããšãã°ãWindowsã®å Žåãã¢ããªã±ãŒã·ã§ã³ã®ããŒã¿ãã«ããŒãžã§ã³ããã«ãããèµ·åæã«è¡šç€ºãããgifãã¡ã€ã«ãæå®ã§ããŸãã
äžè¬ã«ãã¢ã»ã³ããªã«ã¯Electron Builderã䜿çšããããšããå§ãããŸãã ããã¯ããªãã®å€ãã®ç¥çµãæããŸããç§ãä¿¡ããŠãã ããã
ElectronãŠã§ããµã€ãã«ã¢ããªã±ãŒã·ã§ã³ãè¿œå ããŸã
Electronã®ãµã€ãã§Electronã«é¢ããç§ã®ãããžã§ã¯ãã«ã€ããŠè©±ãã®ã¯è¯ãèãã ãšæããŸãã ãããè¡ãã«ã¯ã以äžãå«ããã«ãªã¯ãšã¹ããéä¿¡ããŸãã
- ã_data / apps.ymlãã®ç·šéïŒã¢ããªã±ãŒã·ã§ã³ãæåŸã«è¿œå ïŒ;
- ã¢ããªã±ãŒã·ã§ã³ã¢ã€ã³ã³256x256ãã¯ã»ã«ã®png圢åŒã
- ãããžã§ã¯ãã«é¢é£ä»ããããŠãããããŒã ã®ãã¹ãŠã®ã¡ã³ããŒãã¢ããªã±ãŒã·ã§ã³ãElectronã®Webãµã€ãã«è¡šç€ºãããããšã«åæããããšã瀺ãã¡ãã»ãŒãžã
ç¹°ãè¿ããŸãããããã¯è€éãªããšã§ã¯ãããŸããã prãéä¿¡ããåŸãããªãã¯ãã ææ
¢ããŠãããåãå
¥ããããã®ãåŸ
ã€å¿
èŠããããŸãïŒç§ã®å ŽåãçŽ1é±éããããŸããïŒã
è¿œå ã®è©³çŽ°ãªæé ã«ã€ããŠã¯ã ãã¡ããã芧ãã ãã ã
ãŸãšãããš
ããããElectronã¯ãã€ãã£ããŠãŒã¶ãŒãåžå Žããè¿œãåºãããšããReact NativeãSwiftã殺ãããšããããŸããã Electronã¯ã·ã³ãã«ãªã¢ããªã±ãŒã·ã§ã³ãäœæããã®ã«é©ããŠãããéåžžã«èå³æ·±ããããžã§ã¯ãã§ãã ãããŠåœŒã¯ãšãŠãã·ã³ãã«ã ïŒ ããã³ããšã³ãéçºè ã®æšæºæè¡ã¹ã¿ãã¯ã䜿çšããŠ--shotsãäœæã§ããŸããã
- HTML
- CSS
- Postcss
- Javascript
- NodeJS
- Php
æåã®ã³ãããã¯2016幎9æ24æ¥ã«è¡ãããæåã®ãªãªãŒã¹ã¯ãã®å¹Žã®10æ17æ¥ã«ãªãªãŒã¹ãããŸããã ããã¯ãããã24æ¥åŸã«ããã§ã«äœ¿çšã§ããããŒãžã§ã³ã®ã¢ããªã±ãŒã·ã§ã³ãåãåã£ãããšãæå³ããŸãã ç§ãä»äºãããŠããŠãªã©ãã¯ã¹ããããšæããšããããã¯ååã«éãã§ãã ã ããããã¹ãŠãããªãã®æã«ãããŸãïŒ