[ci skip]update electron-faq.md in Simplified Chinese docs and fix a little words
authorlongbotao <longbotao@didichuxing.com>
Mon, 19 Dec 2016 07:01:50 +0000 (15:01 +0800)
committerlongbotao <longbotao@didichuxing.com>
Mon, 19 Dec 2016 07:01:50 +0000 (15:01 +0800)
docs-translations/zh-CN/README.md
docs-translations/zh-CN/faq/electron-faq.md

index c0116dcd349a559510b1202ff8fed8465eb71c80..e46ce19c2a000a20d3ceedf7791109d38e3f4acc 100644 (file)
@@ -6,7 +6,7 @@
 
 这里是一些被经常问到的问题,再提 issue 之前请先看一下这里。
 
-+ [Electron 常见问题](faq/electron-faq.md) 需要更新
++ [Electron 常见问题](faq/electron-faq.md)
 
 ## 向导
 
@@ -83,7 +83,7 @@
 ## 开发
 
 * [代码规范](development/coding-style.md)
-* [在 C++ 代码中用 clang格式化工具](development/clang-format.md) 未翻译
+* [在 C++ 代码中使用 clang格式化工具](development/clang-format.md) 未翻译
 * [源码目录结构](development/source-code-directory-structure.md)
 * [与 NW.js(原 node-webkit)在技术上的差异](development/atom-shell-vs-node-webkit.md)
 * [构建系统概览](development/build-system-overview.md)
index d898fcc3d0f417722209fe659146fc3af0e2a2e0..092bc1d8ac12c074d252fb77c6349533256362f4 100644 (file)
@@ -16,7 +16,7 @@ Node.js 的新特性通常是由新版本的 V8 带来的。由于 Electron 使
 
 ## 如何在两个网页间共享数据?
 
-在两个网页(渲染进程)间共享数据最简单的方法是使用浏览器中已经实现的 HTML5 API,比较好的方案是用 [Storage API][storage],
+在两个网页(渲染进程)间共享数据最简单的方法是使用浏览器中已经实现的 HTML5 API,其中比较好的方案是用 [Storage API][storage],
 [`localStorage`][local-storage],[`sessionStorage`][session-storage] 或者 [IndexedDB][indexed-db]。
 
 你还可以用 Electron 内的 IPC 机制实现。将数据存在主进程的某个全局变量中,然后在多个渲染进程中使用 `remote` 模块来访问它。
@@ -30,12 +30,12 @@ global.sharedObject = {
 
 ```javascript
 // 在第一个页面中
-require('remote').getGlobal('sharedObject').someProperty = 'new value'
+require('electron').remote.getGlobal('sharedObject').someProperty = 'new value'
 ```
 
 ```javascript
 // 在第二个页面中
-console.log(require('remote').getGlobal('sharedObject').someProperty)
+console.log(require('electron').remote.getGlobal('sharedObject').someProperty)
 ```
 
 ## 为什么应用的窗口、托盘在一段时间后不见了?
@@ -52,17 +52,21 @@ console.log(require('remote').getGlobal('sharedObject').someProperty)
 从
 
 ```javascript
-app.on('ready', function () {
-  var tray = new Tray('/path/to/icon.png')
+const {app, Tray} = require('electron')
+app.on('ready', () => {
+  const tray = new Tray('/path/to/icon.png')
+  tray.setTitle('hello world')
 })
 ```
 
 改为
 
 ```javascript
-var tray = null
-app.on('ready', function () {
+const {app, Tray} = require('electron')
+let tray = null
+app.on('ready', () => {
   tray = new Tray('/path/to/icon.png')
+  tray.setTitle('hello world')
 })
 ```