<!–
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:微软雅黑;
panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
{font-family:华文隶书;
panose-1:2 1 8 0 4 1 1 1 1 1;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:华文楷体;
panose-1:2 1 6 0 4 1 1 1 1 1;}
@font-face
{font-family:”\@微软雅黑”;
panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
{font-family:”\@宋体”;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:”\@华文楷体”;
panose-1:2 1 6 0 4 1 1 1 1 1;}
@font-face
{font-family:”\@华文隶书”;
panose-1:2 1 8 0 4 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
h2
{mso-style-link:”标题 2 Char”;
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
text-align:center;
text-indent:10.0pt;
line-height:115%;
background:#DBE5F1;
border:none;
padding:0cm;
font-size:14.0pt;
font-family:”Calibri”,”sans-serif”;
text-transform:uppercase;
letter-spacing:.75pt;
font-weight:normal;}
h3
{mso-style-link:”标题 3 Char”;
margin-top:15.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
line-height:115%;
border:none;
padding:0cm;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
color:#243F60;
letter-spacing:.75pt;
font-weight:normal;}
h4
{mso-style-name:”标题 4\,代码”;
mso-style-link:”标题 4 Char\,代码 Char”;
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-indent:24.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;
font-weight:normal;}
h5
{mso-style-link:”标题 5 Char”;
margin-top:15.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
line-height:115%;
border:none;
padding:0cm;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
color:#244061;
letter-spacing:.5pt;
font-weight:bold;}
h6
{mso-style-link:”标题 6 Char”;
margin-top:15.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
line-height:115%;
border:none;
padding:0cm;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
color:#365F91;
text-transform:uppercase;
letter-spacing:.5pt;
font-weight:normal;}
p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
{mso-style-link:”标题 7 Char”;
margin-top:15.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
line-height:115%;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
color:#365F91;
text-transform:uppercase;
letter-spacing:.5pt;}
p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
{mso-style-link:”标题 8 Char”;
margin-top:15.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
line-height:115%;
font-size:9.0pt;
font-family:”Calibri”,”sans-serif”;
text-transform:uppercase;
letter-spacing:.5pt;}
p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
{mso-style-link:”标题 9 Char”;
margin-top:15.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
line-height:115%;
font-size:9.0pt;
font-family:”Calibri”,”sans-serif”;
text-transform:uppercase;
letter-spacing:.5pt;
font-style:italic;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoToc2, li.MsoToc2, div.MsoToc2
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:21.0pt;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoToc3, li.MsoToc3, div.MsoToc3
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:42.0pt;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoHeader, li.MsoHeader, div.MsoHeader
{mso-style-link:”页眉 Char”;
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-align:center;
text-indent:10.0pt;
line-height:115%;
layout-grid-mode:char;
border:none;
padding:0cm;
font-size:9.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{mso-style-link:”页脚 Char”;
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-indent:10.0pt;
line-height:115%;
layout-grid-mode:char;
font-size:9.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoCaption, li.MsoCaption, div.MsoCaption
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-indent:10.0pt;
line-height:115%;
font-size:8.0pt;
font-family:”Calibri”,”sans-serif”;
color:#365F91;
font-weight:bold;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
{mso-style-link:”标题 Char”;
margin-top:36.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-indent:10.0pt;
line-height:115%;
font-size:26.0pt;
font-family:”Calibri”,”sans-serif”;
color:#4F81BD;
text-transform:uppercase;
letter-spacing:.5pt;}
p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
{mso-style-link:”副标题 Char”;
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:50.0pt;
margin-left:0cm;
text-indent:10.0pt;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;
color:#595959;
text-transform:uppercase;
letter-spacing:.5pt;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
em
{color:#243F60;
text-transform:uppercase;
letter-spacing:.25pt;
font-style:normal;}
p.MsoDocumentMap, li.MsoDocumentMap, div.MsoDocumentMap
{mso-style-link:”文档结构图 Char”;
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-indent:10.0pt;
line-height:115%;
font-size:9.0pt;
font-family:宋体;}
p
{margin-right:0cm;
margin-left:0cm;
font-size:12.0pt;
font-family:宋体;}
code
{font-family:宋体;}
pre
{mso-style-link:”HTML 预设格式 Char”;
margin:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
font-size:12.0pt;
font-family:宋体;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-link:”批注框文本 Char”;
margin:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
font-size:9.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
{mso-style-link:”无间隔 Char”;
margin:0cm;
margin-bottom:.0001pt;
text-indent:10.0pt;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:36.0pt;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
{margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:36.0pt;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
p.MsoQuote, li.MsoQuote, div.MsoQuote
{mso-style-link:”引用 Char”;
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
text-indent:10.0pt;
line-height:115%;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;
font-style:italic;}
p.MsoIntenseQuote, li.MsoIntenseQuote, div.MsoIntenseQuote
{mso-style-link:”明显引用 Char”;
margin-top:10.0pt;
margin-right:57.6pt;
margin-bottom:0cm;
margin-left:64.8pt;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
text-indent:10.0pt;
line-height:115%;
border:none;
padding:0cm;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;
color:#4F81BD;
font-style:italic;}
span.MsoSubtleEmphasis
{color:#243F60;
font-style:italic;}
span.MsoIntenseEmphasis
{color:#243F60;
text-transform:uppercase;
letter-spacing:.5pt;
font-weight:bold;}
span.MsoSubtleReference
{color:#4F81BD;
font-weight:bold;}
span.MsoIntenseReference
{color:#4F81BD;
text-transform:uppercase;
font-weight:bold;
font-style:italic;}
span.MsoBookTitle
{letter-spacing:.45pt;
font-weight:bold;
font-style:italic;}
p.MsoTocHeading, li.MsoTocHeading, div.MsoTocHeading
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
text-align:center;
text-indent:10.0pt;
line-height:115%;
background:#4F81BD;
border:none;
padding:0cm;
font-size:24.0pt;
font-family:”Calibri”,”sans-serif”;
color:white;
text-transform:uppercase;
letter-spacing:.75pt;
font-weight:bold;}
span.Char
{mso-style-name:”页眉 Char”;
mso-style-link:页眉;}
span.Char0
{mso-style-name:”页脚 Char”;
mso-style-link:页脚;}
span.1Char
{mso-style-name:”标题 1 Char”;
mso-style-link:”标题 1″;
font-family:”微软雅黑”,”sans-serif”;
color:white;
text-transform:uppercase;
letter-spacing:.75pt;
background:#4F81BD;
font-weight:bold;}
span.Char1
{mso-style-name:”文档结构图 Char”;
mso-style-link:文档结构图;
font-family:宋体;}
span.2Char
{mso-style-name:”标题 2 Char”;
mso-style-link:”标题 2″;
font-family:华文隶书;
text-transform:uppercase;
letter-spacing:.75pt;
background:#DBE5F1;}
span.3Char
{mso-style-name:”标题 3 Char”;
mso-style-link:”标题 3″;
color:#243F60;
letter-spacing:.75pt;}
span.4Char
{mso-style-name:”标题 4 Char\,代码 Char”;
mso-style-link:”标题 4\,代码”;}
span.5Char
{mso-style-name:”标题 5 Char”;
mso-style-link:”标题 5″;
color:#244061;
letter-spacing:.5pt;
font-weight:bold;}
span.6Char
{mso-style-name:”标题 6 Char”;
mso-style-link:”标题 6″;
color:#365F91;
text-transform:uppercase;
letter-spacing:.5pt;}
span.7Char
{mso-style-name:”标题 7 Char”;
mso-style-link:”标题 7″;
color:#365F91;
text-transform:uppercase;
letter-spacing:.5pt;}
span.8Char
{mso-style-name:”标题 8 Char”;
mso-style-link:”标题 8″;
text-transform:uppercase;
letter-spacing:.5pt;}
span.9Char
{mso-style-name:”标题 9 Char”;
mso-style-link:”标题 9″;
text-transform:uppercase;
letter-spacing:.5pt;
font-style:italic;}
span.Char2
{mso-style-name:”标题 Char”;
mso-style-link:标题;
color:#4F81BD;
text-transform:uppercase;
letter-spacing:.5pt;}
span.Char3
{mso-style-name:”副标题 Char”;
mso-style-link:副标题;
color:#595959;
text-transform:uppercase;
letter-spacing:.5pt;}
span.Char4
{mso-style-name:”无间隔 Char”;
mso-style-link:无间隔;}
span.Char5
{mso-style-name:”引用 Char”;
mso-style-link:引用;
font-style:italic;}
span.Char6
{mso-style-name:”明显引用 Char”;
mso-style-link:明显引用;
color:#4F81BD;
font-style:italic;}
span.Char7
{mso-style-name:”批注框文本 Char”;
mso-style-link:批注框文本;}
span.HTMLChar
{mso-style-name:”HTML 预设格式 Char”;
mso-style-link:”HTML 预设格式”;
font-family:宋体;}
span.Char8
{mso-style-name:”编号 Char”;
mso-style-link:编号;
font-family:”Times New Roman”,”serif”;}
p.a, li.a, div.a
{mso-style-name:编号;
mso-style-link:”编号 Char”;
margin:0cm;
margin-bottom:.0001pt;
text-indent:0cm;
line-height:150%;
font-size:10.5pt;
font-family:”Times New Roman”,”serif”;}
span.sentence
{mso-style-name:sentence;}
p.a0, li.a0, div.a0
{mso-style-name:图;
mso-style-link:”图 Char”;
margin:0cm;
margin-bottom:.0001pt;
text-align:center;
text-indent:24.0pt;
font-size:12.0pt;
font-family:”Calibri”,”sans-serif”;}
span.Char9
{mso-style-name:”图 Char”;
mso-style-link:图;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.cp
{mso-style-name:cp;}
span.nt
{mso-style-name:nt;}
span.nb
{mso-style-name:nb;}
span.p
{mso-style-name:p;}
span.nx
{mso-style-name:nx;}
span.s2
{mso-style-name:s2;}
span.kc
{mso-style-name:kc;}
span.mi
{mso-style-name:mi;}
span.kd
{mso-style-name:kd;}
span.o
{mso-style-name:o;}
span.na
{mso-style-name:na;}
span.s
{mso-style-name:s;}
span.s1
{mso-style-name:s1;}
p.code, li.code, div.code
{mso-style-name:code;
mso-style-link:”code Char”;
margin-top:5.25pt;
margin-right:0cm;
margin-bottom:5.25pt;
margin-left:0cm;
text-indent:20.15pt;
line-height:10.0pt;
background:#F8F8F8;
border:none;
padding:0cm;
font-size:10.0pt;
font-family:Consolas;
color:#333333;
font-weight:bold;}
span.k
{mso-style-name:k;}
span.codeChar
{mso-style-name:”code Char”;
mso-style-link:code;
font-family:Consolas;
color:#333333;
background:#F8F8F8;
font-weight:bold;}
span.c1
{mso-style-name:c1;}
.MsoChpDefault
{font-size:11.0pt;}
.MsoPapDefault
{margin-top:10.0pt;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;}
/* Page Definitions */
@page WordSection1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
layout-grid:15.6pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
–>
node-webkit教程(7)Platform Service之APP
文/玄魂
前言
几个月前,要开发一个简易的展示应用,要求支持离线播放(桌面应用)和在线播放(web应用)。
当时第一想到的是flex,同一套代码(或者只需少量的更改)就可以同时运行在桌面和浏览器上。由于很多展现效果要全新开发,我想到了impress.js(https://github.com/bartaz/impress.js/)。如果选择impress.js,就意味着要将html5作为桌面应用,当时想到要封装webkit,但是本人对这方面也不是很熟悉,时间也很有限,就又沿着这个方向搜索,找到了node-webkit(https://github.com/rogerwang/node-webkit)。
node-webkit解决了我通过html和js来编写桌面应用的难题。
至于node-webkit的定义,按照作者的说法:
“ 基于node.js和chromium的应用程序实时运行环境,可运行通过HTML(5)、CSS(3)、Javascript来编写的本地应用程序。node.js和webkit的结合体,webkit提供DOM操作,node.js提供本地化操作;且将二者的context完全整合,可在HTML代码中直接使用node.js的API。”
从本篇文章开始,为您介绍Platform Services些列的API,本系列由以下类别:
· App – 每个应用运行时全局api
· Clipboard – 剪贴板
· Tray – 状态栏图标,消息通知
· File dialogs-文件选择对话框
· Shell – 桌面相关
· Handling files and arguments-处理文件和相关参数
7.1 APP 概述
APP类别的API 是针对当前正在运行的应用程序实例的,换个说法是进程级别的(这样说还不准确,node-webkit每一个窗口在单独进程中,应用本身是多进程的)。这些API和程序的启动、关闭关系最密切。但是从目前文档中的API来看,APP类别的API显得不是很丰富。
新建appDemo.html和package.json文件。
package.json内容如下:
{
“name”: “app-demo”,
“main”: “appDemo.html”,
“nodejs”:true,
“window”: {
“title”: “appDemo”,
“toolbar”: true,
“width”: 800,
“height”: 600,
“resizable”:true,
“show_in_taskbar”:true,
“frame”:true,
“kiosk”:false,
“icon”: “2655716405282662783.png”,
},
“webkit”:{
“plugin”:true
}
}
appDemo.html内容如下:
<html>
<head>
<title>appDemo</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
</head>
<body >
<h1>app api 测试</h1>
<script>
// Load native UI library
var gui = require(‘nw.gui’);
var win = gui.Window.get();
</script>
</body>
</html>
7.1 获取APP对象
通过如下方式获得APP对象:
// Load native UI library
var gui = require(‘nw.gui’);
var app = gui.App;
7.2 获取命令行参数
鄙视不标明出处的转载,更多相关内容,欢迎访问玄魂的博客(www.xuanhun521.com)
很多时候,我们启动程序需要从命令行输入参数,可以通过argv、fullArgv和filteredArgv获取输入参数。关于三者的区别参考:https://github.com/rogerwang/node-webkit/wiki/App。我的测试结果和文档还是有出入的。
修改appDemo.html如下:
<html>
<head>
<title>appDemo</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
</head>
<body >
<h1>app api 测试</h1>
<script>
// Load native UI library
var gui = require(‘nw.gui’);
var app = gui.App;
apendText(app.argv);
apendText(app.fullArgv);
apendText(app.filteredArgv);
function apendText(text)
{
var element = document.createElement(‘div’);
element.appendChild(document.createTextNode(text));
document.body.appendChild(element);
}
</script>
</body>
</html>
在命令行启动程序:
运行结果如下:
7.3 dataPath
应用的数据存储目录,在不同的操作系统上路径不同,Windows: %LOCALAPPDATA%/<name>
Linux: ~/.config/<name>
;
OSX:~/Library/Application Support/<name>
这里的<name>是在package.json中定义的name字段的值,所以需要在定义name值的时候保证全局唯一。
7.4 获取manifest
使用manifest属性,可以获取package.json中的json对象。修改appDemo。html的脚本内容如下:
<script>
// Load native UI library
var gui = require(‘nw.gui’);
var app = gui.App;
var manifest = app.manifest;
apendText(manifest.name);
function apendText(text)
{
var element = document.createElement(‘div’);
element.appendChild(document.createTextNode(text));
document.body.appendChild(element);
}
</script>
结果如下:
7.5 清除缓存
鄙视不标明出处的转载,更多相关内容,欢迎访问玄魂的博客(www.xuanhun521.com)
可以调用clearCache()方法,清除应用在内存和磁盘上的缓存。
7.6 关闭程序
关闭程序有两个函数可以调用,分别为closeAllWindows()和quit()方法,两者的区别在于closeAllWindows()方法会发送窗口的关闭消息,我们可以监听close事件(参考:http://www.xuanhun521.com/Blog/2014/4/14/node-webkit%E5%AD%A6%E4%B9%A04native-ui-api-%E4%B9%8Bwindow),阻止窗口关闭或者做其他日志等工作。quit()方法不会发送任何消息,直接退出程序。
7.7 Crash dump
从node-webkit 0.8.0版本开始,如果应用崩溃,一个minidump
文件会被保存到磁盘,用以调试和寻找程序崩溃的原因。默认情况下,dump文件保存在系统的临时文件夹中,我们也可以通过api来设置dump文件的存放目录。以下是个版本系统的临时目录:
· Linux: /tmp
· Windows: System temporary directory
· Mac: ~/Library/Breakpad/product name
(product name is defined in .plist file in the application bundle)
为了方便测试,node-webkit提供了App.crashBrowser()和App.crashRenderer()两个api,分别保存browser 进程和render进程的数据。下面我们通过实例演示将dump文件保存到本地磁盘D。
<script>
// Load native UI library
var gui = require(‘nw.gui’);
var app = gui.App;
app.setCrashDumpDir(‘d:\\’);//设置转储目录
app.crashBrowser();
app.crashRenderer();
function apendText(text)
{
var element = document.createElement(‘div’);
element.appendChild(document.createTextNode(text));
document.body.appendChild(element);
}
</script>
运行程序,应用启动后会崩溃退出,在D盘会看到转储文件:
如何查看转储文件,这里就不详细介绍了,会在专门的文章中讲解,读者现在可以参考文档中的链接:
Decoding the stack trace
To extract the stack trace from the minidump file, you need the minidump_stackwalk
tool, symbols file of node-webkit binary and the minidump (.dmp) file generated from the crash.
See http://www.chromium.org/developers/decoding-crash-dumps
http://code.google.com/p/google-breakpad/wiki/GettingStartedWithBreakpad
Symbols file of official node-webkit binary is provided staring from 0.8.0. It can be downloaded from:
Resources
Linux symbol files of breakpad
https://s3.amazonaws.com/node-webkit/v0.8.0/nw.breakpad.ia32.gz
https://s3.amazonaws.com/node-webkit/v0.8.0/nw.breakpad.x64.gz
windows pdb file
https://s3.amazonaws.com/node-webkit/v0.8.0/nw.exe.pdb.zip
mac dSYM files
https://s3.amazonaws.com/node-webkit/v0.8.0/node-webkit-osx-dsym-v0.8.0.tar.gz
7.8 获取代理
使用getProxyForURL(url),可以获得加载该url时使用的代理信息。返回值使用PAC格式(参考:http://en.wikipedia.org/wiki/Proxy_auto-config)。
7.6 小结
本文内容主要参考node-webkit的官方英文文档,做了适当的调整(https://github.com/rogerwang/node-webkit/wiki/App,
https://github.com/rogerwang/node-webkit/wiki/Crash-dump)。
下一篇文章,介绍Clipboard。
鄙视不标明出处的转载,更多相关内容,欢迎访问玄魂的博客(www.xuanhun521.com)
更多相关内容,欢迎访问玄魂的博客(更多node-webkit相关内容 http://www.xuanhun521.com/Blog/Tag/node-webkit)
ps:nw.js,electron交流群 313717550