{"id":119,"date":"2016-09-29T15:14:01","date_gmt":"2016-09-29T06:14:01","guid":{"rendered":"http:\/\/okamurax.com\/?p=119"},"modified":"2017-07-12T14:21:29","modified_gmt":"2017-07-12T05:21:29","slug":"electron","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=119","title":{"rendered":"Electron\u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"<p>Electron\u3092\u524d\u306b\u4e00\u5ea6\u4f7f\u3063\u305f\u6642\u306e\u30e1\u30e2\u3002\u307e\u3063\u305f\u304f\u5fd8\u308c\u3057\u307e\u3063\u305f\u304c\u4e00\u5fdc\u305d\u306e\u6642\u306e\u30e1\u30e2\u3092\u6b8b\u3057\u3066\u304a\u304f\u3002<\/p>\n<h2>Node\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>nodejs.org\u304b\u3089Node.js\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<p><span style=\"color: #0000ff;\">node -v<\/span><\/p>\n<p><span style=\"color: #0000ff;\">npm -v<br \/>\n<span style=\"color: #333333;\">\u5fc5\u8981\u306a\u3089\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3001<\/span><br \/>\n<span class=\"hljs-built_in\">npm<\/span> install -g <span class=\"hljs-built_in\">npm\u3000\uff08g\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u3067\u30d1\u30b9\u304c\u901a\u308b\uff09<br \/>\nnpm update -g npm <\/span><\/span><\/p>\n<p><del style=\"color: #0000ff;\">npm -g install electron-prebuilt (\u521d\u56de\u306e\u307f)<br \/>\n<\/del><span style=\"color: #0000ff;\">npm install electron<br \/>\n<\/span>\u3053\u308c\u3092\u5b9f\u884c\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\u3002<\/p>\n<p><span style=\"color: #333333;\">app\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u3001app\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u3067\u3001<br \/>\n<\/span><span style=\"color: #0000ff;\">npm init -y\u00a0<\/span><\/p>\n<p>package.json\u306e\u4e2d\u306e\u3001&#8221;main&#8221;: &#8220;index.js&#8221;\u304c\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u3068\u306a\u308b\u306e\u3067\u3001<br \/>\napp\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u306bindex.js\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\n\u3055\u3089\u306bapp\u306e\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u306bindex.html\u3092\u4f5c\u308b\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u3067\u304d\u305f\u3089 electron .\u3000\u3068\u8a18\u8ff0\u3067\u7acb\u3061\u4e0a\u304c\u308b\u3002<br \/>\napp\u30d5\u30a9\u30eb\u30c0\u3067\u4e0a\u8a18\u3092\u5b9f\u884c\u3059\u308b\u3002<\/p>\n<p>index.js<\/p>\n<pre class=\"lang:js decode:true \">var app = require('app');\r\nvar BrowserWindow = require('browser-window'); \r\nrequire('crash-reporter').start();\r\nvar mainWindow = null;\r\napp.on('window-all-closed', function() {\r\n    app.quit();\r\n});\r\napp.on('ready', function() {\r\n  mainWindow = new BrowserWindow({\r\n  \twidth: 1000,\r\n  \theight: 850,\r\n  \tframe: false\r\n  \t});\r\n  mainWindow.loadUrl('file:\/\/' + __dirname + '\/index.html');\r\n  mainWindow.on('closed', function() {\r\n    mainWindow = null;\r\n  });\r\n});<\/pre>\n<p>index.html<\/p>\n<pre class=\"lang:xhtml decode:true  \">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n  &lt;meta charset=\"shift-jis\"&gt;\r\n  &lt;title&gt;Hello Electron&lt;\/title&gt;\r\n  &lt;style&gt;\r\n      body {\r\n      -webkit-app-region: drag;\r\n      -webkit-user-select: none;\r\n    }  \r\n  &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<h2>\u30a2\u30fc\u30ab\u30a4\u30d6\u5316<\/h2>\n<p><span style=\"color: #0000ff;\">npm install -g asar (\u521d\u56de\u306e\u307f)<\/span><\/p>\n<p><span style=\"color: #0000ff;\">asar pack . .\/bin.asar (app\u30d5\u30a9\u30eb\u30c0\u3067)<\/span><\/p>\n<p>electron bin.asar \u3067\u7acb\u3061\u4e0a\u304c\u308b\u3002<\/p>\n<p>\u3053\u3053\u304b\u3089\u914d\u5e03\u7528<\/p>\n<p><span style=\"color: #0000ff;\">npm i electron-packager -g\u3000(\u521d\u56de\u306e\u307f)<\/span><\/p>\n<p><span style=\"color: #0000ff;\">electron-packager . bin &#8211;platform=win32 &#8211;arch=ia32,x64 &#8211;version=0.36.1\u3000<\/span><\/p>\n<p>app\u30d5\u30a9\u30eb\u30c0\u3067\u5b9f\u884c\u3000\u4f55\u304b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u308b\u6a21\u69d8<\/p>\n<p>(\u74b0\u5883\u7279\u6709\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u308b\u6a21\u69d8\u3067\u521d\u56de\u3060\u3051\u6642\u9593\u304c\u304b\u304b\u308b\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3068\u304b\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5909\u3048\u305f\u3089\u307e\u305f\u6642\u9593\u304b\u304b\u308b\u304b\u3082)<\/p>\n<h2>\u305d\u306e\u305f<\/h2>\n<p>\u30e1\u30cb\u30e5\u30fc\u8ffd\u52a0<\/p>\n<pre class=\"lang:js decode:true\">var Menu = require('menu');\r\nvar menu = Menu.buildFromTemplate([\r\n{\r\nlabel: 'Sample',\r\nsubmenu: [\r\n{label: 'About'},\r\n{label: 'Quit'}\r\n]\r\n},\r\n{\r\nlabel: 'File',\r\nsubmenu: [\r\n{label: 'New File'},\r\n{label: 'Paste'}\r\n]\r\n},\r\n{\r\nlabel: 'Edit',\r\nsubmenu: [\r\n{label: 'Copy', accelerator: 'Command+C', selector: 'copy'},\r\n{label: 'Paste', accelerator: 'Command+V', selector: 'paste'}\r\n]\r\n}\r\n]);\r\nMenu.setApplicationMenu(menu);<\/pre>\n<p>index.js\u5185\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u6307\u5b9a<br \/>\n<span style=\"color: #3366ff;\">mainWindow.loadUrl(&#8216;http:\/\/electron.atom.io\/&#8217;);<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Electron\u3092\u524d\u306b\u4e00\u5ea6\u4f7f\u3063\u305f\u6642\u306e\u30e1\u30e2\u3002\u307e\u3063\u305f\u304f\u5fd8\u308c\u3057\u307e\u3063\u305f\u304c\u4e00\u5fdc\u305d\u306e\u6642\u306e\u30e1\u30e2\u3092\u6b8b\u3057\u3066\u304a\u304f\u3002 Node\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb nodejs.org\u304b\u3089Node.js\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb node -v npm -v \u5fc5\u8981\u306a\u3089\u30d0\u30fc\u30b8\u30e7\u30f3 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=119\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Electron\u306e\u4f7f\u3044\u65b9&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-119","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=119"}],"version-history":[{"count":6,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions"}],"predecessor-version":[{"id":1680,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions\/1680"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}