{"id":85204,"date":"2020-03-30T11:55:35","date_gmt":"2020-03-30T03:55:35","guid":{"rendered":"http:\/\/4563.org\/?p=85204"},"modified":"2020-03-30T11:55:35","modified_gmt":"2020-03-30T03:55:35","slug":"electrongo-%e5%ae%9e%e7%8e%b0%e8%b7%a8%e5%b9%b3%e5%8f%b0%e6%98%af%e5%90%a6%e5%8f%af%e8%a1%8c%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=85204","title":{"rendered":"electron+go \u5b9e\u73b0\u8de8\u5e73\u53f0\u662f\u5426\u53ef\u884c\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  electron+go \u5b9e\u73b0\u8de8\u5e73\u53f0\u662f\u5426\u53ef\u884c\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <span><i><\/i> 15<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e94\u4e00\u671f\u95f4\u82b1\u65f6\u95f4\u5b66\u4e60\u4e86\u4e00\u4e0b electron\uff0c\u57fa\u672c\u7b97\u662f\u5165\u95e8\u5427<\/p>\n<p>\u5b66\u4e60\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u89e3\u51b3\u8de8\u5e73\u53f0\u684c\u9762\u5e94\u7528\u7684\u5f00\u53d1\u95ee\u9898\uff0c\u867d\u7136\u4e5f\u7b97\u719f\u6089 Qt\uff0c\u4f46\u662f\u76f8\u5bf9\u76ee\u524d\u65e5\u65b0\u6708\u5f02\u7684\u65b0\u6280\u672f\u6765\u8bf4\uff0c\u6709\u70b9\u592a\u201c\u7ecf\u5178\u201d\u4e86<\/p>\n<p>\u6240\u4ee5\u8003\u8651\u7528 electron \u6765\u505a\u8de8\u5e73\u53f0\u684c\u9762\u5e94\u7528\u5f00\u53d1\uff0c\u6211\u7684\u60f3\u6cd5\u662f\u62ff electron \u505a\u524d\u7aef\uff0c\u518d\u7528 golang \u5199\u4e2a\u540e\u7aef\uff0c\u8d1f\u8d23\u4e00\u4e9b\u6bd4\u8f83\u5e95\u5c42\uff0c\u6216\u8005\u5bf9\u8fd0\u884c\u6548\u7387\u8981\u6c42\u6bd4\u8f83\u9ad8\uff0c\u6291\u6216\u662f\u6709\u4fdd\u5bc6\u9700\u6c42\u7684\u5de5\u4f5c\u3002electron \u548c golang \u7684\u8de8\u5e73\u53f0\u90fd\u975e\u5e38\u5bb9\u6613\u5b9e\u73b0\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u6bd4\u8f83\u5b8c\u7f8e\u7684\u5b9e\u73b0\u8fd9\u4e2a\u9700\u6c42\u3002<\/p>\n<p>\u4e00\u5f00\u59cb\u6211\u628a\u540e\u7aef\u653e\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u4f46\u662f\u5c31\u8981\u6c42\u4f7f\u7528\u8005\u5fc5\u987b\u8981\u8054\u7f51\u624d\u80fd\u4f7f\u7528\uff0c\u8fd9\u4e2a\u6709\u4e9b\u9ebb\u70e6\u3002\u540e\u6765\u627e\u5230 child_process, \u4e8e\u662f\u53ef\u4ee5\u628a\u53ef\u6267\u884c\u7a0b\u5e8f\u76f4\u63a5\u653e\u5728\u7a0b\u5e8f\u5305\u4e2d\uff0c\u7136\u540e spawn \u51fa\u540e\u7aef\u7a0b\u5e8f\uff0c\u518d\u8fdb\u884c\u8fdb\u7a0b\u95f4\u901a\u8baf\u5373\u53ef<\/p>\n<p>\u76ee\u524d\u6709\u51e0\u4e2a\u95ee\u9898\u60f3\u8bf7\u6559\u4e00\u4e0b\u5404\u4f4d\u5927\u4f6c\uff1a<\/p>\n<ol>\n<li>\n<p>\u6709\u5927\u4f6c\u5c1d\u8bd5\u8fc7\u8fd9\u79cd\u7ec4\u5408\u5417\uff1f\u6709\u6ca1\u6709\u4ec0\u4e48\u5751\uff1f\u4e3a\u4ec0\u4e48\u6ca1\u600e\u4e48\u770b\u5230\u6709\u4eba\u8fd9\u4e48\u641e\uff1f<\/p>\n<\/li>\n<li>\n<p>\u4ece electron \u542f\u52a8\u540e\u7aef\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u653e\u5728 app.ready \u4e8b\u4ef6\u4e2d\uff0c\u4f46\u662f\u7a0b\u5e8f\u9000\u51fa\u65f6\u9700\u8981\u81ea\u52a8\u5173\u95ed\u540e\u7aef\uff0c\u653e\u5728\u54ea\u4e2a\u4e8b\u4ef6\u6bd4\u8f83\u5408\u9002\uff1f\u56e0\u4e3a\u6211\u770b\u5230 before-quit, will-quit, quit \u8fd9\u4e09\u4e2a\u4e8b\u4ef6\uff0c\u90fd\u6807\u6ce8\u4e86<\/p>\n<blockquote>\n<p>Note: On Windows, this event will not be emitted if the app is closed due to a shutdown\/restart of the system or a user logout.<\/p>\n<\/blockquote>\n<p>\u800c window-all-closed \u4e8b\u4ef6\uff0c\u53c8\u8bf4<\/p>\n<blockquote>\n<p>If the user pressed Cmd + Q, or the developer called app.quit(), Electron will first try to close all the windows and then emit the will-quit event, and in this case the window-all-closed event would not be emitted.<\/p>\n<\/blockquote>\n<p>\u90a3\u4e48\u5230\u5e95\u653e\u5728\u54ea\u4e2a\u4e8b\u4ef6\u91cc\u66f4\u5408\u9002\u5462\uff1f<\/p>\n<\/li>\n<li>\n<p>\u8fdb\u7a0b\u95f4\u901a\u8baf\u6211\u7528 HTTP \u63a5\u53e3\uff0c\u4e00\u4e2a\u539f\u56e0\u662f\u5f00\u53d1\u65b9\u4fbf\uff0c\u53e6\u4e00\u4e2a\u539f\u56e0\u662f\u505a\u6210 web \u4e5f\u53ef\u4ee5\u901a\u7528\uff0c\u4f46\u662f\u8fd9\u91cc\u5b58\u5728\u4e00\u4e2a\u540e\u7aef\u7ed1\u5b9a\u54ea\u4e2a\u7aef\u53e3\u7684\u95ee\u9898\uff0c\u6211\u60f3\u4e86\u4e24\u4e2a\u65b9\u6848\uff1a<\/p>\n<ul>\n<li>\u65b9\u6848\u4e00\u662f electron \u5148\u627e\u4e00\u4e2a\u53ef\u7528\u7aef\u53e3\uff0c\u7136\u540e\u901a\u8fc7\u547d\u4ee4\u884c\u53c2\u6570\u7684\u65b9\u6cd5\u4f20\u7ed9\u540e\u7aef\uff0c\u7f3a\u70b9\u5728\u4e8e\u6ca1\u6709\u627e\u5230\u4e00\u4e2a\u6bd4\u8f83\u597d\u7684\u67e5\u627e\u53ef\u7528\u7aef\u53e3\u7684\u65b9\u6cd5\uff08\u770b\u4e86\u51e0\u4e2a\u5e93\uff0c\u90fd\u662f\u901a\u8fc7\u5c1d\u8bd5 listen \u7684\u65b9\u6cd5\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5b58\u5728\u4e00\u4e2a\u5c0f\u6982\u7387\u7ade\u4e89\u7684\u53ef\u80fd\u6027\uff09<\/li>\n<li>\u65b9\u6848\u4e8c\u662f\u540e\u7aef\u968f\u673a\u7ed1\u5b9a\u4e00\u4e2a\u7aef\u53e3\uff0c\u7136\u540e\u901a\u8fc7 ipc \u7684\u65b9\u6cd5\uff0c\u7136\u540e\u628a\u7aef\u53e3\u53f7\u4f20\u7ed9\u524d\u7aef\uff0c\u8fd9\u4e2a\u65b9\u6848\u5c31\u662f\u62c5\u5fc3\u6709\u70b9\u4e0d\u901a\u7528<\/li>\n<\/ul>\n<p>\u4e0d\u77e5\u9053\u8fd8\u6709\u6ca1\u6709\u66f4\u597d\u7684\u65b9\u6cd5\uff1f<\/p>\n<\/li>\n<\/ol><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>26<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1406234\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : HuHui <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u518d\u770b\u770b therecipe\/qt                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406235\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @HuHui #1 \u8fd9\u4e2a\u7528\u5230\u4e86 cgo \u5427\uff1f cgo \u7684\u4ea4\u53c9\u7f16\u8bd1\u6709\u4e9b\u9ebb\u70e6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406236\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SingeeKing <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e2a\u4eba\u4e0d\u559c\u6b22 electron \u7684\u4e24\u5927\u539f\u56e0\u662f\u4f53\u79ef\u5927\u548c\u542f\u52a8\u6162\uff0c\u8fd9\u4e2a\u4f3c\u4e4e\u4f18\u5316\u7684\u70b9\u5728\u6267\u884c\u6548\u7387                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406237\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jirajine <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u4e00\u4e2a go \u7684 electron \u7ed1\u5b9a https:\/\/github.com\/asticode\/go-astilectron<br \/>\u4f46\u770b\u8d77\u6765\u4e0d\u592a\u6210\u719f\u3002<br \/>\u81f3\u4e8e\u4f60\u8bf4\u7684\u8d77\u4e00\u4e2a\u540e\u53f0\u670d\u52a1\u7136\u540e IPC \u4ea4\u4e92\u6211\u4e00\u4e2a\u81ea\u5df1\u7528\u7684\u5c0f\u73a9\u610f\u5c31\u662f\u8fd9\u4e48\u641e\u7684\uff0c\u9664\u4e86\u6709\u70b9\u5957\u5a03\u6ca1\u53d1\u73b0\u4ec0\u4e48\u5751\uff0c\u4e5f\u6ca1\u8003\u8651\u90a3\u4e48\u591a\u76f4\u63a5 quit \u5b8c\u4e8b\u3002\u7aef\u53e3\u76f4\u63a5\u968f\u673a\u4e00\u4e2a\u7136\u540e\u53c2\u6570\u4f20\u8fc7\u53bb\u3002<br \/>\u8fd9\u6837\u505a\u597d\u5904\u5c31\u662f\u5929\u7136\u652f\u6301\u540e\u7aef\u8fdc\u7a0b\u8fd0\u884c\uff0c\u4e0d\u7136\u8fd8\u4e0d\u5982\u4f20\u7edf\u7684 native \u6269\u5c55\u65b9\u4fbf\uff0c\u6216\u8005 wasm \u4e5f\u4e0d\u9519\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406238\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pkwenda <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u521a\u60f3\u53d1\u5c31\u88ab\u4e0a\u53d1\u4e86\uff0celectron \u5f88\u91cd\u7684 \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406239\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @SingeeKing #3 \u4f53\u79ef\u5927\u663e\u5f97\u6709\u4efd\u91cf\uff0c\u6709\u5de5\u4f5c\u91cf\uff08:P \uff09\uff0c\u542f\u52a8\u6162\u8fd9\u4e2a\u786e\u5b9e\u6709\u70b9\u4e0d\u597d\uff0c\u4e0d\u8fc7\u73b0\u5728\u6309\u73b0\u5728\u7684\u5e73\u5747\u786c\u4ef6\u6c34\u5e73\uff0c\u5df2\u7ecf\u52c9\u5f3a\u53ef\u4ee5\u63a5\u53d7\u4e86\u3002\u4e3b\u8981\u4f18\u5316\u7684\u70b9\u5728\u4e8e js \u6211\u4e0d\u719f\uff08\u624b\u52a8\u72d7\u5934\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406240\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Jirajine #4 \u611f\u8c22\u63a8\u8350\uff0c\u8fd9\u4e2a\u5e93\u770b\u8d77\u6765\u8fd8\u4e0d\u9519\uff0c\u6211\u597d\u597d\u770b\u770b<br \/>\u4f60\u968f\u673a\u4e00\u4e2a\u7aef\u53e3\uff0c\u5f97\u5148 listen \u4e00\u4e0b\uff0c\u786e\u5b9a\u7aef\u53e3\u6ca1\u88ab\u5360\u7528\uff0c\u7136\u540e\u624d\u80fd\u4f20\u7ed9\u540e\u7aef\u5427\uff1f\u6211\u521a\u624d\u53c8\u60f3\u4e86\u4e00\u4e2a\u65b9\u6848\uff0c\u524d\u7aef\u53ef\u4ee5\u81ea\u5df1 listen \u4e00\u4e2a\u7aef\u53e3 A\uff0c\u7136\u540e\u4f5c\u4e3a\u53c2\u6570\u4f20\u7ed9\u540e\u7aef\uff0c\u540e\u7aef\u968f\u673a listen \u4e00\u4e2a\u7aef\u53e3 B\uff0c\u7136\u540e\u901a\u8fc7\u7aef\u53e3 A \u544a\u77e5\u524d\u7aef\u3002\u8fd9\u6837\u867d\u7136\u6709\u70b9\u7ed5\uff0c\u4f46\u662f\u53ef\u9760\u6027\u9ad8\uff0c\u800c\u4e14\u786e\u4fdd\u8de8\u5e73\u53f0<br \/>wasm \u8fd8\u662f\u518d\u7b49\u7b49\u5427\uff0c\u76ee\u524d\u8fd8\u4e0d\u7b97\u6210\u719f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406241\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SingeeKing <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @teawithlife #6 \u8fd9\u4e0d\u662f\u7b80\u5355\u7684\u300c\u6709\u4efd\u91cf\u300d\u300c\u52c9\u5f3a\u53ef\u4ee5\u63a5\u53d7\u300d\uff0celectron \u5927\u7684\u95ee\u9898\u5728\u4e8e\u65e0\u8bba\u518d\u5c0f\u7684\u5e94\u7528\u90fd\u6253\u5305\u4e86\u4e00\u4e2a\u73af\u5883\u8fdb\u53bb\uff0c\u800c\u4e00\u822c\u4e2a\u4eba\u7535\u8111\u542f\u52a8\u6700\u5feb\u4e5f\u8981 1-2 \u79d2\uff0c\u8fd9\u4e9b\u5728\u4e00\u8d77\u5c31\u771f\u7684\u5bf9 electron \u96be\u4ee5\u6709\u597d\u611f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406242\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : murmur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             electron \u76ee\u524d\u770b\u5230\u6bd4\u8f83\u6210\u529f\u7684\u5e94\u7528\u5c31\u662f vscode \u4e86\uff0c\u5176\u4f59\u7684\u90fd\u4e0d\u662f\u4e25\u683c\u7684 electron\uff0c\u5c24\u5176\u662f\u56fd\u4ea7\u90a3\u5806\u8f6f\u4ef6\uff0c\u4f60\u770b\u7740\u662f chrome \u5957\u58f3\uff0c\u80cc\u540e\u8fa3\u4e48\u4e00\u5927\u5806 dll \u90fd\u4e0d\u77e5\u9053\u5e72\u5565\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406243\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jason94 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. \u4e4b\u524d\u770b\u5230\u8fd9\u7bc7 https:\/\/wiredcraft.com\/blog\/high-security-electron-js-application\/\uff0c\u4e5f\u60f3\u8fd9\u4e48\u641e\uff0c\u540e\u6765\u611f\u89c9\u6709\u70b9\u9ebb\u70e6\uff0c\u4e3b\u8981\u5c31\u662f\u4e0d\u597d\u7ef4\u62a4\u3002\u4fdd\u5bc6\u8fd9\u5757\u53ef\u4ee5\u8003\u8651 js \u6e90\u7801 \u8f6c\u5b57\u8282\u7801\uff08\u76ee\u524d\u5728\u51e0\u5341\u4e07\u7528\u6237\u8fd0\u884c\u6ca1\u95ee\u9898\uff09<br \/>2. before-quit \u6216 will-quit \u3002\u5982\u679c\u7a97\u53e3\u5173\u95ed\u4e4b\u524d\u4e0d\u505a\u64cd\u4f5c\u7684\u8bdd\uff0c\u53ef\u4ee5\u4e22 before-quit \u91cc<br \/>3. \u65b9\u6848\u4e00\u53ef\u4ee5\u7528\u8fd9\u4e2a\u5e93 https:\/\/www.npmjs.com\/package\/portfinder                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406244\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ysc3839 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u7136\u8003\u8651 Golang + Cef \uff1f<br \/>https:\/\/github.com\/CzarekTomczak\/cef2go                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406245\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @SingeeKing #8 \u8fd9\u4e2a\u8bdd\u9898\u8bb0\u5f97\u4e4b\u524d V2 \u4e5f\u6709\u51e0\u4e2a\u4e3b\u9898\u8ba8\u8bba\u8fc7\uff0c\u6211\u90e8\u5206\u8d5e\u540c\u4f60\u7684\u89c2\u70b9\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u6709\u8ffd\u6c42\u7684\u7a0b\u5e8f\u5458\u6765\u8bf4\uff0c\u4f53\u79ef\u5927\u6267\u884c\u6162\u786e\u5b9e\u96be\u4ee5\u5fcd\u53d7\uff0c\u4f46\u540c\u65f6\u6211\u8ba4\u4e3a\u8fd9\u662f\u4e3a\u4e86\u5b9e\u73b0\u8de8\u5e73\u53f0\u6240\u8981\u4ed8\u51fa\u7684\u4ee3\u4ef7\uff0c\u5176\u5b9e Qt\uff0cgolang \u90fd\u662f\u8fd9\u4e48\u4e00\u4e2a\u5957\u8def\uff0c\u628a\u6574\u4e2a runtime \u90fd\u6253\u5305\u4e86\uff08\u5f53\u7136\u4ed6\u4eec\u6ca1 electron \u90a3\u4e48\u81c3\u80bf\uff09\u3002\u6240\u4ee5\uff0c\u7b97\u662f\u6709\u820d\u6709\u5f97\u5427\uff0c\u5c31\u770b\u4f60\u4ee5\u53ca\u4f60\u7684\u6700\u7ec8\u7528\u6237\u770b\u91cd\u5565\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406246\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @jason94 #10 \u4fdd\u5bc6\u662f\u5176\u4e2d\u4e00\u4e2a\u539f\u56e0\u5427\uff0c\u4e3b\u8981\u8fd8\u662f\u6211\u4f5c\u4e3a crud boy\uff0c\u5bf9\u524d\u7aef\u53ea\u505c\u7559\u5728 ctrl+c\/v \u7a0b\u5e8f\u5458\u7684\u7a0b\u5ea6\uff0c\u6240\u4ee5\u9700\u8981\u628a\u5927\u90e8\u5206\u903b\u8f91\u5de5\u4f5c\u653e\u5230\u540e\u7aef\u6765\u5b9e\u73b0<br \/>\u4f60\u8bf4\u7684 portfinder \u5e93\u6211\u770b\u8fc7\u6e90\u7801\uff0c\u5c31\u662f\u6211\u8bf4\u7684\u904d\u5386\u5c1d\u8bd5 listen \u7684\u65b9\u6cd5\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5b58\u5728\u4e00\u4e2a\u6781\u5c0f\u6982\u7387\u7684 race condition\uff0c\u53ef\u80fd\u524d\u7aef\u68c0\u67e5\u7684\u65f6\u5019\uff0c\u8fd9\u4e2a\u7aef\u53e3\u662f\u53ef\u7528\u7684\uff0c\u4f46\u662f\u7b49\u5230\u540e\u7aef\u8c03\u7528\u65f6\uff0c\u8fd9\u4e2a\u7aef\u53e3\u5df2\u7ecf\u88ab\u5176\u4ed6\u8fdb\u7a0b\u62a2\u5148\u5360\u7528\u4e86\uff08\u867d\u7136\u6982\u7387\u6781\u4f4e\uff0c\u4f46\u8fd9\u786e\u5b9e\u662f\u53ef\u9884\u89c1\u7684\u98ce\u9669\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406247\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ysc3839 #11 \u8fd9\u4e2a\u5e93\u7684 commit \u8bb0\u5f55\uff0c\u4ece 2014 \u5e74\u4e4b\u540e\u7684\u8bb0\u5f55\uff0c\u90fd\u662f\u5728\u6539 README \u4e86\uff0c\u4e0d\u6562\u7528\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406248\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jirajine <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @teawithlife \u88ab\u5360\u4e86\u542f\u52a8\u670d\u52a1\u4f1a\u7ed1\u5b9a\u5931\u8d25\uff0cjs \u5904\u7406\u4e0b\u9519\u8bef\u91cd\u65b0\u968f\u673a\u4e00\u4e2a\u518d\u6b21\u542f\u52a8\uff0c\u8fd9\u4e2a\u51e0\u7387\u672c\u8eab\u4e5f\u5f88\u5c0f\uff0c\u6216\u8005\u7528\u4e0a\u63d0\u5230\u7684\u5e93\u3002<br \/>wasm \u6bd5\u7adf\u662f\u672a\u6765\uff0c\u9ad8\u6027\u80fd\u6269\u5c55\u4e0d\u7528\u518d\u5305\u88c5\u4e00\u5806\u4e11\u964b\u7684 C \u63a5\u53e3\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406249\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Jirajine #15 \u5bf9\u54e6\uff0c\u542f\u52a8\u4e0d\u8d77\u6765\u6362\u4e2a\u7aef\u53e3\u518d\u6765\u4e00\u904d\u5c31\u884c\u4e86\uff0c\u6211\u548b\u628a\u8fd9\u4e2a\u529e\u6cd5\u7ed9\u5fd8\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406250\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : optional <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             wasm \u4e0d\u4e8c\u9009\u62e9\u554a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406251\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kuyuzhiqi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u7684\uff0c\u4e0d\u96be\uff0c\u4e0d\u540c\u7684\u5e73\u53f0\u8fd0\u884c\u65f6\u628a go \u7684\u8fd0\u884c\u73af\u5883\u5e26\u4e0a\uff0celectron \u90a3\u8fb9\u542f\u52a8 go \u7684\u670d\u52a1\u5c31\u884c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406252\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ece\u4e0b\u5348\u5230\u665a\u4e0a\u90fd\u5728\u7814\u7a76\u6253\u5305\u7684\u95ee\u9898\uff0c\u589e\u52a0\u4e00\u4e9b\u989d\u5916\u7684\u4fe1\u606f\u7ed9\u9700\u8981\u7684\u670b\u53cb\uff1a<\/p>\n<p>1. \u76ee\u524d\u6253\u5305\u7684\u5de5\u5177\u6709\u4e24\u4e2a electron-builder \u548c electron-packager\uff0c\u7528 electron-vue \u5efa\u7acb\u9879\u76ee\u65f6\uff0c\u53ef\u4ee5\u9009\u62e9\u5176\u4e00\u4f5c\u4e3a\u6253\u5305\u5de5\u5177<\/p>\n<p>2. electron-builder \u529f\u80fd\u8f83\u5168\uff0c\u914d\u7f6e\u6bd4\u8f83\u9ebb\u70e6\uff0c\u9664\u4e86\u6253\u5305\u4e4b\u5916\uff0c\u53ef\u4ee5\u5236\u4f5c\u5404\u79cd\u5b89\u88c5\u5305\uff0celectron-packager \u6bd4\u8f83\u7b80\u5355\u6613\u7528\u3002\u6211\u6d4b\u8bd5\u4e86\u7528 electron-packager \u5728 linux \u5e73\u53f0\u751f\u6210 linux \u548c windows \u7684\u53ef\u6267\u884c\u7a0b\u5e8f\uff0c\u5982\u679c\u8981\u751f\u6210 windows \u5e73\u53f0\u7a0b\u5e8f\uff0c\u9700\u8981\u5148\u81ea\u884c\u88c5 wine \uff08\u636e\u8bf4\u662f\u4e3a\u4e86\u6539\u56fe\u6807\uff09\uff0c\u4e5f\u6d4b\u8bd5\u4e86\u7528 electron-builder \u5728 linux \u5e73\u53f0\u751f\u6210 windows \u4e0b\u7684\u53ef\u6267\u884c\u7a0b\u5e8f\u548c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u6ca1\u6709\u9700\u8981\u81ea\u5df1\u5b89\u88c5\u7684\u5de5\u5177\uff0c\u751f\u6210\u7684\u8fc7\u7a0b\u4f1a\u81ea\u52a8\u4e0b\u8f7d\uff08\u4e0d\u6e05\u695a\u662f\u5426\u9700\u8981 wine\uff0c\u56e0\u4e3a\u5df2\u7ecf\u88c5\u8fc7\u4e86\uff09\uff0c\u5176\u4ed6\u7684\u5e73\u53f0\u5c31\u6ca1\u6d4b\u8bd5\u4e86\uff08\u6ce8\u610f\uff0c\u4e3a\u4e86\u786e\u4fdd\u4e0b\u8f7d\u6210\u529f\uff0c\u8bf7\u79d1\u5b66\u4e0a\u7f51\uff09<\/p>\n<p>3. \u4e24\u4e2a\u5de5\u5177\u5728\u6253\u5305\u7684\u65f6\u5019\u90fd\u53ef\u4ee5\u8bbe\u7f6e\u4e00\u4e2a asar \u53c2\u6570\uff0c\u5982\u679c\u4e3a true\uff0c\u4f1a\u628a\u6574\u4e2a app \u6253\u5305\u4e3a\u4e00\u4e2a asar \u6587\u4ef6\uff0c\u8fd9\u6837\u636e\u8bf4\u53ef\u4ee5\u63d0\u9ad8 IO \u6548\u7387\uff08\u7279\u522b\u662f\u5728 windows \u4e0b\uff09\uff0c\u7531\u4e8e\u7a0b\u5e8f\u8f83\u5c0f\uff0c\u6ca1\u6709\u660e\u663e\u611f\u89c9\uff0c\u4f46\u662f\u5728\u590d\u5236\u7684\u65f6\u5019\u6709\u660e\u663e\u533a\u522b\uff0c\u56e0\u4e3a\u4e0d\u6253\u5305\u7684\u8bdd\uff0cnode_modules \u8fd9\u4e2a\u6587\u4ef6\u5939\u5f97\u590d\u5236\u534a\u5929<\/p>\n<p>4. \u5982\u679c\u542f\u7528 asar \u6587\u4ef6\uff0c\u5728 child_process \u91cc\u9762\u7684\u51fd\u6570\uff0cexec, fork, spawn \u5168\u90e8\u90fd\u4e0d\u80fd\u7528\uff0c\u53ea\u80fd\u7528 execFile\uff0c\u5982\u679c\u786e\u5b9e\u60f3\u7528\uff0c\u53ef\u4ee5\u5c06\u9700\u8981\u6267\u884c\u7684\u6587\u4ef6\uff0c\u4ece asar \u6587\u4ef6\u4e2d\u590d\u5236\u51fa\u6765 <\/p>\n<p>5. \u6211\u628a\u540e\u7aef\u7a0b\u5e8f\u653e\u5230\u4e86 static \u6587\u4ef6\u5939\u4e2d\uff0c\u53d1\u73b0\u6253\u5305\u4e4b\u540e\uff0c`dist\/static\/`\u6587\u4ef6\u5939\u867d\u7136\u5df2\u7ecf\u6709\u4e86\u7a0b\u5e8f\uff0c\u4f46\u662f\u6587\u4ef6\u5c5e\u6027\u4ece 755 \u53d8\u6210 644 \u4e86\uff0c\u539f\u56e0\u662f electron-vue \u7684\u6253\u5305\u811a\u672c\u4e2d\uff0c\u590d\u5236 static \u6587\u4ef6\u5939\u65f6\uff0c\u7528\u7684\u662f copy-webpack-plugin\uff0c\u5b83\u8fd9\u4e2a issue \u81f3\u4eca\u672a\u89e3\u51b3\u3002\u6211\u6700\u540e\u6ca1\u529e\u6cd5\uff0c\u76f4\u63a5\u4fee\u6539 build.js \u6587\u4ef6\uff0c\u590d\u5236\u5b8c\u6210\u4e4b\u540e\uff0c\u624b\u52a8\u6267\u884c\u4e00\u6b21`chmod +x`\uff0c\u628a\u6743\u9650\u6539\u56de\u6765                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406253\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qwe121002 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u4eba\u4f1a\u505a h5 \u8df3\u8f6c\u8f6c\u8d26\u7684\u4ed8\u6b3e\u6a21\u5f0f\u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406254\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @qwe121002 #20 \u63d0\u95ee\u7684\u8bdd\uff0c\u6700\u597d\u5355\u72ec\u53d1\u4e00\u4e2a\u4e3b\u9898\uff0c\u5c3d\u91cf\u63cf\u8ff0\u6e05\u695a\u4f60\u7684\u76ee\u7684\u548c\u5df2\u7ecf\u505a\u4e86\u54ea\u4e9b\u5c1d\u8bd5\uff0c\u8fd9\u6837\u4f1a\u6709\u66f4\u591a\u7684\u4eba\u5e2e\u52a9\u4f60                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406255\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : buffzty <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u7684\u60f3\u6cd5\u8ddf\u4f60\u4e00\u6837. \u684c\u9762\u8f6f\u4ef6\u7528 electron+tsx \u505a\u524d\u7aef\u5c55\u793a. \u5927\u90e8\u5206\u529f\u80fd\u7528 node \u5199, \u518d\u7528 go \u8d77\u4e00\u4e2a http \u670d\u52a1\u5668 \u505a\u4e00\u4e9b\u672c\u6765\u9700\u8981\u7528 c \u5b8c\u6210\u7684\u529f\u80fd.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406256\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @buffzty #22 \u5bf9\u7684\uff0c\u5c31\u662f\u8fd9\u4e48\u4e2a\u601d\u8def\u3002\u90a3\u4f60\u5728\u5b9e\u9645\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u6709\u78b0\u5230\u4ec0\u4e48\u95ee\u9898\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406257\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : buffzty <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @teawithlife \u8fd8\u6ca1\u5199\u8fc7 pc \u7aef\u9879\u76ee,\u6211\u4eec\u73b0\u5728\u5168\u90e8\u90fd\u662f web. \u524d\u7aef tsx, \u540e\u7aef go .\u6211\u89c9\u5f97\u5957\u4e2a electron \u5e94\u8be5\u95ee\u9898\u4e0d\u5927                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406258\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @buffzty #24 \u4f5c\u4e3a\u4e1a\u4f59\u524d\u7aef\uff0c\u6211\u7684\u64cd\u4f5c\u662f\u627e\u4e2a vue+element-ui \u6a21\u677f\u6539\u4e00\u6539\uff0c\u641e\u5b9a\u663e\u793a\u7684\u5185\u5bb9\uff0c\u6240\u6709\u7684\u903b\u8f91\u653e\u5230\u540e\u7aef\u6765\u5b9e\u73b0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1406259\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qwe121002 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @qwe121002 <br \/>@teawithlife \u597d\u7684\uff0c\u8c22\u8c22                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>electron+go \u5b9e\u73b0\u8de8\u5e73\u53f0&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/85204"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=85204"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/85204\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=85204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=85204"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=85204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}