From f96c76584f21626a2eb054ef844444f16e744590 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 26 Aug 2015 17:27:17 -0700 Subject: [PATCH 01/59] First run at ipc-m-p edits --- docs/api/ipc-main-process.md | 52 ++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/docs/api/ipc-main-process.md b/docs/api/ipc-main-process.md index d558f7fb24d6..b29d56f6ba37 100644 --- a/docs/api/ipc-main-process.md +++ b/docs/api/ipc-main-process.md @@ -1,17 +1,19 @@ # ipc (main process) -Handles asynchronous and synchronous message sent from a renderer process (web -page). +The `ipc` module, when used in the main process, handles asynchronous and synchronous messages sent from a renderer process (web page). Messages sent from a renderer will be emitted to this module. -The messages sent from a renderer would be emitted to this module, the event name -is the `channel` when sending message. To reply a synchronous message, you need -to set `event.returnValue`, to send an asynchronous back to the sender, you can -use `event.sender.send(...)`. +## Sending Messages -It's also possible to send messages from main process to the renderer process, -see [WebContents.send](browser-window.md#webcontentssendchannel-args) for more. +It is also possible to send messages from the main process to the renderer +process, see [WebContents.send](browser-window.md#webcontentssendchannel-args) +for more information. -An example of sending and handling messages: +- When sending a message, the event name is the `channel`. +- To reply a synchronous message, you need to set `event.returnValue`. +- To send an asynchronous back to the sender, you can use `event.sender.send(...)`. + +An example of sending and handling messages between the render and main +processes: ```javascript // In main process. @@ -38,12 +40,34 @@ ipc.on('asynchronous-reply', function(arg) { ipc.send('asynchronous-message', 'ping'); ``` -## Class: Event +## Methods -### Event.returnValue +The `ipc` module has the following method: -Assign to this to return an value to synchronous messages. +### `ipc.on(channel, callback)` -### Event.sender +* `channel` String - The event name. +* `callback` Function -The `WebContents` that sent the message. +When the event occurs the `callback` is called with an `event` object and a +message, `arg`. + +## IPC Events + +The `event` object passed to the `callback` has the following methods: + +### `Event.returnValue` + +Set this to the value to be returned in a synchronous message. + +### `Event.sender` + +Returns the `WebContents` that sent the message. + +### `Event.sender.send(channel, arg)` + +* `channel` String - The event name. +* `arg` + +This sends an asynchronous message back to the render process. The message, +`arg`, can be any value. From a34a16653eb50529c42d92933ba94cca0b3b6e0f Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 26 Aug 2015 17:32:47 -0700 Subject: [PATCH 02/59] Standardize global-shortcut --- docs/api/global-shortcut.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/api/global-shortcut.md b/docs/api/global-shortcut.md index 54da5638d194..52ec17326c63 100644 --- a/docs/api/global-shortcut.md +++ b/docs/api/global-shortcut.md @@ -1,9 +1,12 @@ # global-shortcut The `global-shortcut` module can register/unregister a global keyboard shortcut -with the operating system, so that you can customize the operations for various shortcuts. -Note that the shortcut is global; it will work even if the app does not have the keyboard focus. -You should not use this module until the `ready` event of the app module is emitted. +with the operating system so that you can customize the operations for various +shortcuts. + +Note that the shortcut is global; it will work even if the app does +not have the keyboard focus. You should not use this module until the `ready` +event of the app module is emitted. ```javascript var app = require('app'); @@ -32,7 +35,11 @@ app.on('will-quit', function() { }); ``` -## globalShortcut.register(accelerator, callback) +## Methods + +The `global-shortcut` module has the following methods: + +### `globalShortcut.register(accelerator, callback)` * `accelerator` [Accelerator](accelerator.md) * `callback` Function @@ -40,18 +47,18 @@ app.on('will-quit', function() { Registers a global shortcut of `accelerator`. The `callback` is called when the registered shortcut is pressed by the user. -## globalShortcut.isRegistered(accelerator) +### `globalShortcut.isRegistered(accelerator)` * `accelerator` [Accelerator](accelerator.md) Returns `true` or `false` depending on whether the shortcut `accelerator` is registered. -## globalShortcut.unregister(accelerator) +### `globalShortcut.unregister(accelerator)` * `accelerator` [Accelerator](accelerator.md) -Unregisters the global shortcut of `keycode`. +Unregisters the global shortcut of `accelerator`. -## globalShortcut.unregisterAll() +### `globalShortcut.unregisterAll()` Unregisters all the global shortcuts. From 71f46c02877fd1d42b5e6de195572ab2727d2503 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 26 Aug 2015 17:52:45 -0700 Subject: [PATCH 03/59] =?UTF-8?q?arg=20=E2=86=92=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/ipc-main-process.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/api/ipc-main-process.md b/docs/api/ipc-main-process.md index b29d56f6ba37..197b98e418be 100644 --- a/docs/api/ipc-main-process.md +++ b/docs/api/ipc-main-process.md @@ -64,10 +64,9 @@ Set this to the value to be returned in a synchronous message. Returns the `WebContents` that sent the message. -### `Event.sender.send(channel, arg)` +### `Event.sender.send(channel[, message])` * `channel` String - The event name. -* `arg` +* `message` (optional) -This sends an asynchronous message back to the render process. The message, -`arg`, can be any value. +This sends an asynchronous message back to the render process. The `message` can be any value. From a1f17069ec3a742bc83697c4bbf4c73a1a669834 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 26 Aug 2015 17:56:10 -0700 Subject: [PATCH 04/59] First run t ipc-r --- docs/api/ipc-renderer.md | 44 +++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/docs/api/ipc-renderer.md b/docs/api/ipc-renderer.md index 3aee11d781c9..0d7b49aba701 100644 --- a/docs/api/ipc-renderer.md +++ b/docs/api/ipc-renderer.md @@ -1,29 +1,41 @@ # ipc (renderer) The `ipc` module provides a few methods so you can send synchronous and -asynchronous messages to the main process, and also receive messages sent from -main process. If you want to make use of modules of main process from renderer +asynchronous messages from the render process (web page) to the main process. You can also receive messages returned from the main process. + +**Note**: If you want to make use of modules in the main process from the renderer process, you might consider using the [remote](remote.md) module. -See [ipc (main process)](ipc-main-process.md) for examples. +See [ipc (main process)](ipc-main-process.md) for code examples. -## ipc.send(channel[, args...]) +## Methods -Send `args..` to the renderer via `channel` in asynchronous message, the main -process can handle it by listening to the `channel` event of `ipc` module. +The `ipc` module has the following methods for sending messages: -## ipc.sendSync(channel[, args...]) +**Note**: When using these methods to send a `message` you must also listen for it in the main process with [`ipc (main process)`](ipc-main-process.md). -Send `args..` to the renderer via `channel` in synchronous message, and returns -the result sent from main process. The main process can handle it by listening to -the `channel` event of `ipc` module, and returns by setting `event.returnValue`. +### `ipc.send(channel[, message])` -**Note:** Usually developers should never use this API, since sending -synchronous message would block the whole renderer process. +* `channel` String - The event name. +* `message` (optional) -## ipc.sendToHost(channel[, args...]) +Send a `message` (any type) to the main process asynchronously via a `channel`. The main process handles it by listening for the `channel` event with `ipc`. -Like `ipc.send` but the message will be sent to the host page instead of the -main process. +### `ipc.sendSync(channel[, message])` -This is mainly used by the page in `` to communicate with host page. +* `channel` String - The event name. +* `message` (optional) + +Send a `message` (any type) to the main process synchronously via a `channel`. A result is returned from the main process. + +The main process handles it by listening for the `channel` event with `ipc` and replies by setting the `event.returnValue`. + +**Note:** Sending a synchronous message will block the whole renderer process so +using this method is not recommended. + +### `ipc.sendToHost(channel[, message])` + +* `channel` String - The event name. +* `message` (optional) + +Like `ipc.send` but the message will be sent to the host page in a `` instead of the main process. From d02ced87b8481262f489ae4d87ff5366459ea263 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Thu, 27 Aug 2015 10:13:25 -0700 Subject: [PATCH 05/59] =?UTF-8?q?message=20=E2=86=92=20arg,=2080-col?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/ipc-main-process.md | 7 ++++--- docs/api/ipc-renderer.md | 29 ++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/docs/api/ipc-main-process.md b/docs/api/ipc-main-process.md index 197b98e418be..c34564ef82ef 100644 --- a/docs/api/ipc-main-process.md +++ b/docs/api/ipc-main-process.md @@ -64,9 +64,10 @@ Set this to the value to be returned in a synchronous message. Returns the `WebContents` that sent the message. -### `Event.sender.send(channel[, message])` +### `Event.sender.send(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. -* `message` (optional) +* `arg` (optional) -This sends an asynchronous message back to the render process. The `message` can be any value. +This sends an asynchronous message back to the render process. Optionally, there +can be one or a series of arguments, `arg`, which can have any type. diff --git a/docs/api/ipc-renderer.md b/docs/api/ipc-renderer.md index 0d7b49aba701..4a5995663884 100644 --- a/docs/api/ipc-renderer.md +++ b/docs/api/ipc-renderer.md @@ -1,7 +1,8 @@ # ipc (renderer) The `ipc` module provides a few methods so you can send synchronous and -asynchronous messages from the render process (web page) to the main process. You can also receive messages returned from the main process. +asynchronous messages from the render process (web page) to the main process. +You can also receive messages returned from the main process. **Note**: If you want to make use of modules in the main process from the renderer process, you might consider using the [remote](remote.md) module. @@ -12,30 +13,40 @@ See [ipc (main process)](ipc-main-process.md) for code examples. The `ipc` module has the following methods for sending messages: -**Note**: When using these methods to send a `message` you must also listen for it in the main process with [`ipc (main process)`](ipc-main-process.md). +**Note**: When using these methods to send a `message` you must also listen +for it in the main process with [`ipc (main process)`](ipc-main-process.md). -### `ipc.send(channel[, message])` +### `ipc.send(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. * `message` (optional) -Send a `message` (any type) to the main process asynchronously via a `channel`. The main process handles it by listening for the `channel` event with `ipc`. +Send an event to the main process asynchronously via a `channel`. Optionally, +there can be a message: one or a series of arguments, `arg`, which can have any +type. The main process handles it by listening for the `channel` event with +`ipc`. -### `ipc.sendSync(channel[, message])` +### `ipc.sendSync(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. * `message` (optional) -Send a `message` (any type) to the main process synchronously via a `channel`. A result is returned from the main process. +Send an event to the main process synchronously via a `channel`. Optionally, +there can be a message: one or a series of arguments, `arg`, which can have any +type. The main process handles it by listening for the `channel` event with +`ipc`. -The main process handles it by listening for the `channel` event with `ipc` and replies by setting the `event.returnValue`. +The main process handles it by listening for the `channel` event with `ipc` and +replies by setting the `event.returnValue`. **Note:** Sending a synchronous message will block the whole renderer process so using this method is not recommended. -### `ipc.sendToHost(channel[, message])` +### `ipc.sendToHost(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. * `message` (optional) -Like `ipc.send` but the message will be sent to the host page in a `` instead of the main process. +Like `ipc.send` but the event will be sent to the host page in a `` +instead of the main process. Optionally, there can be a message: one or a series +of arguments, `arg`, which can have any type. From 852d982057bb3858c7373512c22ecdfddd6a354b Mon Sep 17 00:00:00 2001 From: fscherwi Date: Fri, 28 Aug 2015 22:04:42 +0200 Subject: [PATCH 06/59] :arrow_up: asar@0.8.x --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ccaa24d3c0e..101fdeee257a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "electron", "devDependencies": { - "asar": "0.7.x", + "asar": "0.8.x", "coffee-script": "^1.9.2", "coffeelint": "^1.9.4", "request": "*", From dd28a2ef146343c96878d8957c0bf58697c3b3d1 Mon Sep 17 00:00:00 2001 From: Brandon Nozaki Miller Date: Fri, 28 Aug 2015 14:16:05 -0700 Subject: [PATCH 07/59] Update documentation to clarify bundled node/io.js version --- docs/tutorial/using-native-node-modules.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tutorial/using-native-node-modules.md b/docs/tutorial/using-native-node-modules.md index 6b9631296f4c..918c8a67a94a 100644 --- a/docs/tutorial/using-native-node-modules.md +++ b/docs/tutorial/using-native-node-modules.md @@ -7,14 +7,14 @@ the location of Electron's headers when building native modules. ## Native Node module compatibility Since Node v0.11.x there were vital changes in the V8 API. So generally all -native modules written for Node v0.10.x wouldn't work for Node v0.11.x. And -because Electron internally uses Node v0.11.13, it carries with the same +native modules written for Node v0.10.x wouldn't work for newer Node or io.js versions. And +because Electron internally uses __io.js v3.1.0__, it carries with the same problem. -To solve this, you should use modules that support Node v0.11.x, +To solve this, you should use modules that support Node v0.11.x or later, [many modules](https://www.npmjs.org/browse/depended/nan) do support both now. For old modules that only support Node v0.10.x, you should use the -[nan](https://github.com/rvagg/nan) module to port it to v0.11.x. +[nan](https://github.com/rvagg/nan) module to port it to v0.11.x or later versions of Node or io.js. ## How to install native modules From dbc1855b42a4aaeeb2bc5d35f3e3f9cd179509da Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 14:21:37 -0700 Subject: [PATCH 08/59] Small edits --- docs/api/global-shortcut.md | 5 +++-- docs/api/ipc-main-process.md | 11 +++++++---- docs/api/ipc-renderer.md | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/api/global-shortcut.md b/docs/api/global-shortcut.md index 52ec17326c63..f9ca654cf50a 100644 --- a/docs/api/global-shortcut.md +++ b/docs/api/global-shortcut.md @@ -4,7 +4,7 @@ The `global-shortcut` module can register/unregister a global keyboard shortcut with the operating system so that you can customize the operations for various shortcuts. -Note that the shortcut is global; it will work even if the app does +**Note**: The shortcut is global; it will work even if the app does not have the keyboard focus. You should not use this module until the `ready` event of the app module is emitted. @@ -51,7 +51,8 @@ the registered shortcut is pressed by the user. * `accelerator` [Accelerator](accelerator.md) -Returns `true` or `false` depending on whether the shortcut `accelerator` is registered. +Returns `true` or `false` depending on whether the shortcut `accelerator` is +registered. ### `globalShortcut.unregister(accelerator)` diff --git a/docs/api/ipc-main-process.md b/docs/api/ipc-main-process.md index c34564ef82ef..bbb581fcfc9b 100644 --- a/docs/api/ipc-main-process.md +++ b/docs/api/ipc-main-process.md @@ -1,6 +1,8 @@ # ipc (main process) -The `ipc` module, when used in the main process, handles asynchronous and synchronous messages sent from a renderer process (web page). Messages sent from a renderer will be emitted to this module. +The `ipc` module, when used in the main process, handles asynchronous and +synchronous messages sent from a renderer process (web page). Messages sent from +a renderer will be emitted to this module. ## Sending Messages @@ -10,7 +12,8 @@ for more information. - When sending a message, the event name is the `channel`. - To reply a synchronous message, you need to set `event.returnValue`. -- To send an asynchronous back to the sender, you can use `event.sender.send(...)`. +- To send an asynchronous back to the sender, you can use + `event.sender.send(...)`. An example of sending and handling messages between the render and main processes: @@ -40,9 +43,9 @@ ipc.on('asynchronous-reply', function(arg) { ipc.send('asynchronous-message', 'ping'); ``` -## Methods +## Listening for Messages -The `ipc` module has the following method: +The `ipc` module has the following method to listen for events: ### `ipc.on(channel, callback)` diff --git a/docs/api/ipc-renderer.md b/docs/api/ipc-renderer.md index 4a5995663884..12cd11aec777 100644 --- a/docs/api/ipc-renderer.md +++ b/docs/api/ipc-renderer.md @@ -2,7 +2,7 @@ The `ipc` module provides a few methods so you can send synchronous and asynchronous messages from the render process (web page) to the main process. -You can also receive messages returned from the main process. +You can also receive replies from the main process. **Note**: If you want to make use of modules in the main process from the renderer process, you might consider using the [remote](remote.md) module. From 8ee91bce44798a64fe969c7b5f1ba4d6e230c373 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 14:57:14 -0700 Subject: [PATCH 09/59] =?UTF-8?q?message=20=E2=86=92=20arg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/ipc-renderer.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/ipc-renderer.md b/docs/api/ipc-renderer.md index 12cd11aec777..3adb0bc95476 100644 --- a/docs/api/ipc-renderer.md +++ b/docs/api/ipc-renderer.md @@ -19,7 +19,7 @@ for it in the main process with [`ipc (main process)`](ipc-main-process.md). ### `ipc.send(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. -* `message` (optional) +* `arg` (optional) Send an event to the main process asynchronously via a `channel`. Optionally, there can be a message: one or a series of arguments, `arg`, which can have any @@ -29,7 +29,7 @@ type. The main process handles it by listening for the `channel` event with ### `ipc.sendSync(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. -* `message` (optional) +* `arg` (optional) Send an event to the main process synchronously via a `channel`. Optionally, there can be a message: one or a series of arguments, `arg`, which can have any @@ -45,7 +45,7 @@ using this method is not recommended. ### `ipc.sendToHost(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. -* `message` (optional) +* `arg` (optional) Like `ipc.send` but the event will be sent to the host page in a `` instead of the main process. Optionally, there can be a message: one or a series From 33a19f9071b8d7a76cd583545451bc2f6815c135 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 16:19:28 -0700 Subject: [PATCH 10/59] Edits and standardization --- docs/api/menu-item.md | 9 +++- docs/api/menu.md | 95 +++++++++++++++++++++++-------------------- 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/docs/api/menu-item.md b/docs/api/menu-item.md index 360a48ab98e0..88535ad93e30 100644 --- a/docs/api/menu-item.md +++ b/docs/api/menu-item.md @@ -1,7 +1,14 @@ -# menu-item +# menuItem + +The `menu-item` module allows you to add items to an application or content +[`menu`](menu.md). + +See [`menu`](menu.md) for examples. ## Class: MenuItem +Create a new `MenuItem` with the following method: + ### new MenuItem(options) * `options` Object diff --git a/docs/api/menu.md b/docs/api/menu.md index 06400d116917..b6a0c75571cc 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -1,12 +1,17 @@ # menu -The `Menu` class is used to create native menus that can be used as -application menus and context menus. Each menu consists of multiple menu -items, and each menu item can have a submenu. +The `menu` class is used to create native menus that can be used as +application menus and +[context menus](https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/PopupGuide/ContextMenus). +This module is a main process module which can be used in a render process via +the `remote` module. -Below is an example of creating a menu dynamically in a web page by using -the [remote](remote.md) module, and showing it when the user right clicks -the page: +Each menu consists of multiple [menu items](menu-item.md) and each menu item can +have a submenu. + +Below is an example of creating a menu dynamically in a web page +(render process) by using the [remote](remote.md) module, and showing it when +the user right clicks the page: ```html @@ -27,9 +32,11 @@ window.addEventListener('contextmenu', function (e) { ``` -Another example of creating the application menu with the simple template API: +An example of creating the application menu in the render process with the +simple template API: -**Note to Window and Linux users** the `selector` member of each menu item is a Mac-only [Accelerator option](https://github.com/atom/electron/blob/master/docs/api/accelerator.md). +**Note to Window and Linux users** the `selector` member of each menu item is a +Mac-only [Accelerator option](https://github.com/atom/electron/blob/master/docs/api/accelerator.md). ```html @@ -167,102 +174,104 @@ Menu.setApplicationMenu(menu); ## Class: Menu -### new Menu() +### `new Menu()` Creates a new menu. -### Class Method: Menu.setApplicationMenu(menu) +## Methods + +The `menu` class has the following methods: + +### `Menu.setApplicationMenu(menu)` * `menu` Menu Sets `menu` as the application menu on OS X. On Windows and Linux, the `menu` will be set as each window's top menu. -### Class Method: Menu.sendActionToFirstResponder(action) +### `Menu.sendActionToFirstResponder(action)` _OS X_ * `action` String -Sends the `action` to the first responder of application, this is used for +Sends the `action` to the first responder of application. This is used for emulating default Cocoa menu behaviors, usually you would just use the `selector` property of `MenuItem`. -**Note:** This method is OS X only. - -### Class Method: Menu.buildFromTemplate(template) +### `Menu.buildFromTemplate(template)` * `template` Array -Generally, the `template` is just an array of `options` for constructing -[MenuItem](menu-item.md), the usage can be referenced above. +Generally, the `template` is just an array of `options` for constructing a +[MenuItem](menu-item.md). The usage can be referenced above. -You can also attach other fields to element of the `template`, and they will -become properties of the constructed menu items. +You can also attach other fields to the element of the `template` and they +will become properties of the constructed menu items. -### Menu.popup(browserWindow, [x, y]) +### `Menu.popup(browserWindow[, x, y])` * `browserWindow` BrowserWindow -* `x` Number -* `y` Number +* `x` Number (optional) +* `y` Number (optional) -Popups this menu as a context menu in the `browserWindow`. You can optionally -provide a `(x,y)` coordinate to place the menu at, otherwise it will be placed -at the current mouse cursor position. +Pops up this menu as a context menu in the `browserWindow`. You +can optionally provide a `x,y` coordinate to place the menu at, otherwise it +will be placed at the current mouse cursor position. -### Menu.append(menuItem) +### `Menu.append(menuItem)` * `menuItem` MenuItem Appends the `menuItem` to the menu. -### Menu.insert(pos, menuItem) +### `Menu.insert(pos, menuItem)` * `pos` Integer * `menuItem` MenuItem Inserts the `menuItem` to the `pos` position of the menu. -### Menu.items +### `Menu.items()` -Get the array containing the menu's items. +Get an array containing the menu's items. -## Notes on OS X application menu +## Notes on OS X Application Menu OS X has a completely different style of application menu from Windows and -Linux, and here are some notes on making your app's menu more native-like. +Linux, here are some notes on making your app's menu more native-like. -### Standard menus +### Standard Menus On OS X there are many system defined standard menus, like the `Services` and `Windows` menus. To make your menu a standard menu, you can just set your menu's -label to one of followings, and Electron will recognize them and make them +label to one of following and Electron will recognize them and make them become standard menus: * `Window` * `Help` * `Services` -### Standard menu item actions +### Standard Menu Item Actions OS X has provided standard actions for some menu items (which are called `selector`s), like `About xxx`, `Hide xxx`, and `Hide Others`. To set the action of a menu item to a standard action, you can set the `selector` attribute of the menu item. -### Main menu's name +### Main Menu's Name On OS X the label of application menu's first item is always your app's name, no matter what label you set. To change it you have to change your app's name by modifying your app bundle's `Info.plist` file. See [About Information Property List Files](https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html) -for more. +for more information. -## Menu item position +## Menu Item Position -You can make use of `position` and `id` to control how the item would be placed +You can make use of `position` and `id` to control how the item will be placed when building a menu with `Menu.buildFromTemplate`. -The `position` attribute of `MenuItem` has the form `[placement]=[id]` where +The `position` attribute of `MenuItem` has the form `[placement]=[id]`, where placement is one of `before`, `after`, or `endof` and `id` is the unique ID of an existing item in the menu: @@ -272,12 +281,12 @@ an existing item in the menu: * `after` - Inserts this item after id referenced item. If the referenced item doesn't exist the item will be inserted at the end of the menu. * `endof` - Inserts this item at the end of the logical group containing - the id referenced item. (Groups are created by separator items). If - the referenced item doesn't exist a new separator group is created with + the id referenced item (groups are created by separator items). If + the referenced item doesn't exist, a new separator group is created with the given id and this item is inserted after that separator. -When an item is positioned following unpositioned items are inserted after -it, until a new item is positioned. So if you want to position a group of +When an item is positioned, all un-positioned items are inserted after +it until a new item is positioned. So if you want to position a group of menu items in the same location you only need to specify a position for the first item. From e8461b6f90b71e0d527bea493f702616de07e893 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 16:35:22 -0700 Subject: [PATCH 11/59] Capital Ms --- docs/api/menu-item.md | 2 +- docs/api/menu.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/menu-item.md b/docs/api/menu-item.md index 88535ad93e30..71b69b850a69 100644 --- a/docs/api/menu-item.md +++ b/docs/api/menu-item.md @@ -1,4 +1,4 @@ -# menuItem +# MenuItem The `menu-item` module allows you to add items to an application or content [`menu`](menu.md). diff --git a/docs/api/menu.md b/docs/api/menu.md index b6a0c75571cc..eaa486390fd9 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -1,4 +1,4 @@ -# menu +# Menu The `menu` class is used to create native menus that can be used as application menus and From a38d34d368aad6313acb28ee8f3f0edd9ffabea3 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 21:33:45 -0700 Subject: [PATCH 12/59] Standardize native-image --- docs/api/native-image.md | 70 ++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/docs/api/native-image.md b/docs/api/native-image.md index 4d4fb4bbf5be..03b1a309113e 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -1,17 +1,17 @@ # NativeImage -In Electron for the APIs that take images, you can pass either file paths or -`NativeImage` instances. When passing `null`, an empty image will be used. +In Electron, for the APIs that take images, you can pass either file paths or +`NativeImage` instances. An empty image will be used when `null` is passed. -For example, when creating a tray or setting a window's icon, you can pass an image -file path as a `String`: +For example, when creating a tray or setting a window's icon, you can pass an +image file path as a `String`: ```javascript var appIcon = new Tray('/Users/somebody/images/icon.png'); var window = new BrowserWindow({icon: '/Users/somebody/images/window.png'}); ``` -Or read the image from the clipboard: +Or read the image from the clipboard which returns a `NativeImage`: ```javascript var clipboard = require('clipboard'); @@ -31,7 +31,7 @@ On Windows, you can also load `ICO` icon from a file path. On platforms that have high-DPI support, you can append `@2x` after image's file name's base name to mark it as a high resolution image. -For example if `icon.png` is a normal image that has standard resolution, the +For example if `icon.png` is a normal image that has standard resolution, then `icon@2x.png` would be treated as a high resolution image that has double DPI density. @@ -65,7 +65,7 @@ Following suffixes as DPI denses are also supported: * `@4x` * `@5x` -## Template image +## Template Image Template images consist of black and clear colors (and an alpha channel). Template images are not intended to be used as standalone images and are usually @@ -74,72 +74,80 @@ mixed with other content to create the desired final appearance. The most common case is to use template image for menu bar icon so it can adapt to both light and dark menu bars. -Template image is only supported on Mac. +Template image is only supported on OS X. -To mark an image as template image, its filename should end with the word +To mark an image as a template image, its filename should end with the word `Template`, examples are: * `xxxTemplate.png` * `xxxTemplate@2x.png` -## nativeImage.createEmpty() +## Methods + +The `NativeImage` class has the following methods: + +### `NativeImage.createEmpty()` Creates an empty `NativeImage` instance. -## nativeImage.createFromPath(path) +### `NativeImage.createFromPath(path)` * `path` String Creates a new `NativeImage` instance from a file located at `path`. -## nativeImage.createFromBuffer(buffer[, scaleFactor]) +### `NativeImage.createFromBuffer(buffer[, scaleFactor])` * `buffer` [Buffer][buffer] -* `scaleFactor` Double +* `scaleFactor` Double (optional) -Creates a new `NativeImage` instance from `buffer`. The `scaleFactor` is 1.0 by -default. +Creates a new `NativeImage` instance from `buffer`. The default `scaleFactor` is +1.0. -## nativeImage.createFromDataUrl(dataUrl) +### `NativeImage.createFromDataUrl(dataUrl)` * `dataUrl` String Creates a new `NativeImage` instance from `dataUrl`. -## Class: NativeImage +## Instance Methods -This class is used to represent an image. +The following methods are available on instances of `nativeImage` -### NativeImage.toPng() +```javascript +var image = nativeImage.createFromPath('/Users/somebody/images/icon.png') +``` -Returns a [Buffer][buffer] that contains image's `PNG` encoded data. +### `image.toPng()` -### NativeImage.toJpeg(quality) +Returns a [Buffer][buffer] that contains the image's `PNG` encoded data. -* `quality` Integer between 0 - 100 (required) +### `image.toJpeg(quality)` -Returns a [Buffer][buffer] that contains image's `JPEG` encoded data. +* `quality` Integer between 0 - 100 (**required**) -### NativeImage.toDataUrl() +Returns a [Buffer][buffer] that contains the image's `JPEG` encoded data. -Returns the data URL of image. +### `image.toDataUrl()` -### NativeImage.isEmpty() +Returns the data URL of the image. -Returns whether the image is empty. +### `image.isEmpty()` -### NativeImage.getSize() +Returns a boolean whether the image is empty. + +### `image.getSize()` Returns the size of the image. [buffer]: https://iojs.org/api/buffer.html#buffer_class_buffer -### NativeImage.setTemplateImage(option) +### `image.setTemplateImage(option)` * `option` Boolean Marks the image as template image. -### NativeImage.isTemplateImage() +### `image.isTemplateImage()` -Returns whether the image is a template image. +Returns a boolean whether the image is a template image. From 83aa9df1ee70b88e63e1e5bb474fd65f6196d5dc Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 21:37:07 -0700 Subject: [PATCH 13/59] Standardize power-monitor --- docs/api/power-monitor.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/api/power-monitor.md b/docs/api/power-monitor.md index 4643110f35bb..c9a33cc1a128 100644 --- a/docs/api/power-monitor.md +++ b/docs/api/power-monitor.md @@ -1,10 +1,10 @@ # power-monitor -The `power-monitor` module is used to monitor the power state change. You can -only use it on the main process. You should not use this module until the `ready` -event of `app` module gets emitted. +The `power-monitor` module is used to monitor power state changes. You can +only use it on the main process. You should not use this module until the `ready` +event of the `app` module is emitted. -An example is: +For example: ```javascript var app = require('app'); @@ -16,18 +16,22 @@ app.on('ready', function() { }); ``` -## Event: suspend +## Events + +The `power-monitor` module emits the following events: + +### Event: 'suspend' Emitted when the system is suspending. -## Event: resume +### Event: 'resume' Emitted when system is resuming. -## Event: on-ac +### Event: 'on-ac' Emitted when the system changes to AC power. -## Event: on-battery +### Event: 'on-battery' Emitted when system changes to battery power. From 91150839be96fbcad156de4f9757d41bc1da07ba Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 21:44:13 -0700 Subject: [PATCH 14/59] Standardize power-save-blocker --- docs/api/power-save-blocker.md | 44 +++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/docs/api/power-save-blocker.md b/docs/api/power-save-blocker.md index 23b1252c6789..451dde105da8 100644 --- a/docs/api/power-save-blocker.md +++ b/docs/api/power-save-blocker.md @@ -1,9 +1,10 @@ -# power-save-blocker +# powerSaveBlocker The `power-save-blocker` module is used to block the system from entering -low-power(sleep) mode, allowing app to keep system and screen active. +low-power (sleep) mode thus allowing the app to keep the system and screen +active. -An example is: +For example: ```javascript var powerSaveBlocker = require('power-save-blocker'); @@ -14,35 +15,40 @@ console.log(powerSaveBlocker.isStarted(id)); powerSaveBlocker.stop(id); ``` -## powerSaveBlocker.start(type) +## Methods -* `type` String - Power save blocker type +The `powerSaveBlocker` module has the following methods: + +### `powerSaveBlocker.start(type)` + +* `type` String - Power save blocker type. * `prevent-app-suspension` - Prevent the application from being suspended. - Keeps system active, but allows screen to be turned off. Example use cases: - downloading a file, playing audio. - * `prevent-display-sleep`- Prevent the display from going to sleep. Keeps system - and screen active. Example use case: playing video. + Keeps system active but allows screen to be turned off. Example use cases: + downloading a file or playing audio. + * `prevent-display-sleep`- Prevent the display from going to sleep. Keeps + system and screen active. Example use case: playing video. -Starts the power save blocker preventing the system entering lower-power mode. -Returns an integer identified the power save blocker. +Starts the power save blocker preventing the system from entering lower-power +mode. Returns an integer identifying the power save blocker. -**Note:** -`prevent-display-sleep` has higher precedence level than `prevent-app-suspension`. -Only the highest precedence type takes effect. In other words, `prevent-display-sleep` -always take precedence over `prevent-app-suspension`. +**Note:** `prevent-display-sleep` has higher has precedence over +`prevent-app-suspension`. Only the highest precedence type takes effect. In +other words, `prevent-display-sleep` always take precedence over +`prevent-app-suspension`. For example, an API calling A requests for `prevent-app-suspension`, and another calling B requests for `prevent-display-sleep`. `prevent-display-sleep` -will be used until B stops its request. After that, `prevent-app-suspension` is used. +will be used until B stops its request. After that, `prevent-app-suspension` +is used. -## powerSaveBlocker.stop(id) +### `powerSaveBlocker.stop(id)` * `id` Integer - The power save blocker id returned by `powerSaveBlocker.start`. Stops the specified power save blocker. -## powerSaveBlocker.isStarted(id) +### `powerSaveBlocker.isStarted(id)` * `id` Integer - The power save blocker id returned by `powerSaveBlocker.start`. -Returns whether the corresponding `powerSaveBlocker` starts. +Returns a boolean whether the corresponding `powerSaveBlocker` has started. From a5969fd0764db21ee4f7589d0a09a1ccb7343744 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 21:47:31 -0700 Subject: [PATCH 15/59] Standardize process --- docs/api/process.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/api/process.md b/docs/api/process.md index c9efa22fe0f9..15a1cca19f08 100644 --- a/docs/api/process.md +++ b/docs/api/process.md @@ -1,13 +1,18 @@ -# Process object +# Process The `process` object in Electron has the following differences from the one in upstream node: -* `process.type` String - Process's type, can be `browser` (i.e. main process) or `renderer`. +* `process.type` String - Process's type, can be `browser` (i.e. main process) + or `renderer`. * `process.versions['electron']` String - Version of Electron. * `process.versions['chrome']` String - Version of Chromium. * `process.resourcesPath` String - Path to JavaScript source code. -## process.hang +# Methods + +The `process` object has the following method: + +### `process.hang` Causes the main thread of the current process hang. From b7599992724951a37b844f168a802008bb834229 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 22:03:39 -0700 Subject: [PATCH 16/59] Standardize protocol --- docs/api/protocol.md | 108 ++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/docs/api/protocol.md b/docs/api/protocol.md index be0cad0d5de0..ba4160d7c321 100644 --- a/docs/api/protocol.md +++ b/docs/api/protocol.md @@ -3,7 +3,7 @@ The `protocol` module can register a custom protocol or intercept an existing protocol. -An example of implementing a protocol that has the same effect with the +An example of implementing a protocol that has the same effect as the `file://` protocol: ```javascript @@ -24,48 +24,52 @@ app.on('ready', function() { **Note:** This module can only be used after the `ready` event was emitted. -## protocol.registerStandardSchemes(schemes) +## Methods + +The `protocol` module has the following methods: + +### `protocol.registerStandardSchemes(schemes)` * `schemes` Array - Custom schemes to be registered as standard schemes. -A standard scheme adheres to what RFC 3986 calls +A standard `scheme` adheres to what RFC 3986 calls [generic URI syntax](https://tools.ietf.org/html/rfc3986#section-3). This includes `file:` and `filesystem:`. -## protocol.registerFileProtocol(scheme, handler[, completion]) +### `protocol.registerFileProtocol(scheme, handler[, completion])` * `scheme` String * `handler` Function -* `completion` Function +* `completion` Function (optional) -Registers a protocol of `scheme` that will send file as response, the `handler` +Registers a protocol of `scheme` that will send the file as a response. The `handler` will be called with `handler(request, callback)` when a `request` is going to be -created with `scheme`, and `completion` will be called with `completion(null)` +created with `scheme` and `completion` will be called with `completion(null)` when `scheme` is successfully registered, or `completion(error)` when failed. -To handle the `request`, the `callback` should be called with either file's path -or an object that has `path` property, e.g. `callback(filePath)` or +To handle the `request`, the `callback` should be called with either the file's +path or an object that has a `path` property, e.g. `callback(filePath)` or `callback({path: filePath})`. -When `callback` is called with nothing, or a number, or an object that has -`error` property, the `request` will be failed with the `error` number you -specified. For the available error numbers you can use, please check: +When `callback` is called with nothing, a number, or an object that has an +`error` property, the `request` will fail with the `error` number you +specified. For the available error numbers you can use, please see: https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h -By default the scheme is treated like `http:`, which is parsed differently -from protocols that follows "generic URI syntax" like `file:`, so you probably -want to call `protocol.registerStandardSchemes` to make your scheme treated as +By default the `scheme` is treated like `http:`, which is parsed differently +from protocols that follow "generic URI syntax" like `file:`, so you probably +want to call `protocol.registerStandardSchemes` to have your scheme treated as a standard scheme. -## protocol.registerBufferProtocol(scheme, handler[, completion]) +### `protocol.registerBufferProtocol(scheme, handler[, completion])` * `scheme` String * `handler` Function -* `completion` Function +* `completion` Function (optional) -Registers a protocol of `scheme` that will send `Buffer` as response, the -`callback` should be called with either an `Buffer` object, or an object that -has `data`, `mimeType`, `chart` properties. +Registers a protocol of `scheme` that will send a `Buffer` as a response. The +`callback` should be called with either a `Buffer` object or an object that +has the `data`, `mimeType`, and `chart` properties. Example: @@ -78,37 +82,37 @@ protocol.registerBufferProtocol('atom', function(request, callback) { }); ``` -## protocol.registerStringProtocol(scheme, handler[, completion]) +### `protocol.registerStringProtocol(scheme, handler[, completion])` * `scheme` String * `handler` Function -* `completion` Function +* `completion` Function (optional) -Registers a protocol of `scheme` that will send `String` as response, the -`callback` should be called with either a `String`, or an object that -has `data`, `mimeType`, `chart` properties. +Registers a protocol of `scheme` that will send a `String` as a response. The +`callback` should be called with either a `String` or an object that has the +`data`, `mimeType`, and `chart` properties. -## protocol.registerHttpProtocol(scheme, handler[, completion]) +### `protocol.registerHttpProtocol(scheme, handler[, completion])` * `scheme` String * `handler` Function -* `completion` Function +* `completion` Function (optional) -Registers a protocol of `scheme` that will send a HTTP request as response, the -`callback` should be called with an object that has `url`, `method`, `referer`, -`session` properties. +Registers a protocol of `scheme` that will send an HTTP request as a response. +The `callback` should be called with an object that has the `url`, `method`, +`referer`, and `session` properties. -By default the HTTP request will reuse current session, if you want the request -to have different session you should specify `session` to `null`. +By default the HTTP request will reuse the current session. If you want the +request to have a different session you should set `session` to `null`. -## protocol.unregisterProtocol(scheme[, completion]) +### `protocol.unregisterProtocol(scheme[, completion])` * `scheme` String -* `completion` Function +* `completion` Function (optional) Unregisters the custom protocol of `scheme`. -## protocol.isProtocolHandled(scheme, callback) +### `protocol.isProtocolHandled(scheme, callback)` * `scheme` String * `callback` Function @@ -116,43 +120,43 @@ Unregisters the custom protocol of `scheme`. The `callback` will be called with a boolean that indicates whether there is already a handler for `scheme`. -## protocol.interceptFileProtocol(scheme, handler[, completion]) +### `protocol.interceptFileProtocol(scheme, handler[, completion])` * `scheme` String * `handler` Function -* `completion` Function +* `completion` Function (optional) -Intercepts `scheme` protocol and use `handler` as the protocol's new handler -which sends file as response. +Intercepts `scheme` protocol and uses `handler` as the protocol's new handler +which sends a file as a response. -## protocol.interceptStringProtocol(scheme, handler[, completion]) +### `protocol.interceptStringProtocol(scheme, handler[, completion])` * `scheme` String * `handler` Function -* `completion` Function +* `completion` Function (optional) -Intercepts `scheme` protocol and use `handler` as the protocol's new handler -which sends String as response. +Intercepts `scheme` protocol and uses `handler` as the protocol's new handler +which sends a `String` as a response. -## protocol.interceptBufferProtocol(scheme, handler[, completion]) +## `protocol.interceptBufferProtocol(scheme, handler[, completion])` * `scheme` String * `handler` Function -* `completion` Function +* `completion` Function (optional) -Intercepts `scheme` protocol and use `handler` as the protocol's new handler -which sends `Buffer` as response. +Intercepts `scheme` protocol and uses `handler` as the protocol's new handler +which sends a `Buffer` as a response. -## protocol.interceptHttpProtocol(scheme, handler[, completion]) +## `protocol.interceptHttpProtocol(scheme, handler[, completion])` * `scheme` String * `handler` Function -* `completion` Function +* `completion` Function (optional) -Intercepts `scheme` protocol and use `handler` as the protocol's new handler -which sends a new HTTP request as response. +Intercepts `scheme` protocol and uses `handler` as the protocol's new handler +which sends a new HTTP request as a response. -## protocol.uninterceptProtocol(scheme[, completion]) +## `protocol.uninterceptProtocol(scheme[, completion])` * `scheme` String * `completion` Function From 50736296a7de8bb4ee733c7110433e9d4af30c7a Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 22:17:35 -0700 Subject: [PATCH 17/59] Standardize remote --- docs/api/remote.md | 85 ++++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/docs/api/remote.md b/docs/api/remote.md index c06920836cdb..5658b0781656 100644 --- a/docs/api/remote.md +++ b/docs/api/remote.md @@ -1,29 +1,29 @@ # remote The `remote` module provides a simple way to do inter-process communication -between the renderer process and the main process. +between the renderer process (web page) and the main process. In Electron, only GUI-unrelated modules are available in the renderer process. -Without the `remote` module, users who wanted to call a main process API in +Without the `remote` module, users who want to call a main process API in the renderer process would have to explicitly send inter-process messages -to the main process. With the `remote` module, users can invoke methods of -main process object without explicitly sending inter-process messages, -similar to Java's -[RMI](http://en.wikipedia.org/wiki/Java_remote_method_invocation). +to the main process. With the `remote` module, users can invoke methods of the +main process object without explicitly sending inter-process messages, similar +to Java's [RMI](http://en.wikipedia.org/wiki/Java_remote_method_invocation). -An example of creating a browser window in renderer process: +An example of creating a browser window from a renderer process: ```javascript var remote = require('remote'); var BrowserWindow = remote.require('browser-window'); + var win = new BrowserWindow({ width: 800, height: 600 }); win.loadUrl('https://github.com'); ``` -Note: for the reverse (access renderer process from main process), you can use -[webContents.executeJavascript](browser-window.md#webcontents-executejavascript-code). +**Note**: for the reverse (access the renderer process from the main process), +you can use [webContents.executeJavascript](browser-window.md#webcontents-executejavascript-code). -## Remote objects +## Remote Objects Each object (including functions) returned by the `remote` module represents an object in the main process (we call it a remote object or remote function). @@ -36,30 +36,31 @@ In the example above, both `BrowserWindow` and `win` were remote objects and Instead, it created a `BrowserWindow` object in the main process and returned the corresponding remote object in the renderer process, namely the `win` object. -## Lifetime of remote objects +## Lifetime of Remote Objects Electron makes sure that as long as the remote object in the renderer process lives (in other words, has not been garbage collected), the corresponding object -in the main process would never be released. When the remote object has been -garbage collected, the corresponding object in the main process would be +in the main process will never be released. When the remote object has been +garbage collected, the corresponding object in the main process will be dereferenced. -If the remote object is leaked in renderer process (e.g. stored in a map but never -freed), the corresponding object in the main process would also be leaked, +If the remote object is leaked in the renderer process (e.g. stored in a map but +never freed), the corresponding object in the main process will also be leaked, so you should be very careful not to leak remote objects. Primary value types like strings and numbers, however, are sent by copy. ## Passing callbacks to the main process -Code in the main process can accept callbacks from the renderer - for instance the `remote` module - -but you should be extremely careful when using this feature. +Code in the main process can accept callbacks from the renderer - for instance +the `remote` module - but you should be extremely careful when using this feature. First, in order to avoid deadlocks, the callbacks passed to the main process are called asynchronously. You should not expect the main process to get the return value of the passed callbacks. -For instance you can't use a function from the renderer process in a `Array.map` called in the main process: +For instance you can't use a function from the renderer process in an +`Array.map` called in the main process: ```javascript // main process mapNumbers.js @@ -69,10 +70,12 @@ exports.withRendererCallback = function(mapper) { exports.withLocalCallback = function() { return exports.mapNumbers(function(x) { - return x + 1; + return x + 1; }); } +``` +```javascript // renderer process var mapNumbers = require("remote").require("mapNumbers"); @@ -85,8 +88,9 @@ var withLocalCb = mapNumbers.withLocalCallback() console.log(withRendererCb, withLocalCb) // [true, true, true], [2, 3, 4] ``` -As you can see, the renderer callback's synchronous return value was not as expected, -and didn't match the return value of an indentical callback that lives in the main process. +As you can see, the renderer callback's synchronous return value was not as +expected, and didn't match the return value of an identical callback that lives +in the main process. Second, the callbacks passed to the main process will persist until the main process garbage-collects them. @@ -96,45 +100,52 @@ callback for the `close` event on a remote object: ```javascript var remote = require('remote'); + remote.getCurrentWindow().on('close', function() { // blabla... }); ``` But remember the callback is referenced by the main process until you -explicitly uninstall it! If you do not, each time you reload your window the callback will -be installed again, leaking one callback each restart. +explicitly uninstall it. If you do not, each time you reload your window the +callback will be installed again, leaking one callback for each restart. -To make things worse, since the context of previously installed callbacks have been released, -when the `close` event was emitted exceptions would be raised in the main process. +To make things worse, since the context of previously installed callbacks have +been released, when the `close` event was emitted exceptions will be raised in +the main process. -To avoid this problem, ensure you clean up any references to renderer callbacks passed to the main -process. This involves cleaning up event handlers, or ensuring the main process is explicitly told to deference -callbacks that came from a renderer process that is exiting. +To avoid this problem, ensure you clean up any references to renderer callbacks +passed to the main process. This involves cleaning up event handlers, or +ensuring the main process is explicitly told to deference callbacks that came +from a renderer process that is exiting. -## remote.require(module) +## Methods + +The `remote` module has the following methods: + +### `remote.require(module)` * `module` String Returns the object returned by `require(module)` in the main process. -## remote.getCurrentWindow() +### `remote.getCurrentWindow()` -Returns the [BrowserWindow](browser-window.md) object which this web page -belongs to. +Returns the [`BrowserWindow`](browser-window.md) object to which this web page +belongs. -## remote.getCurrentWebContents() +### `remote.getCurrentWebContents()` -Returns the WebContents object of this web page. +Returns the [`WebContents`](web-contents.md) object of this web page. -## remote.getGlobal(name) +### `remote.getGlobal(name)` * `name` String Returns the global variable of `name` (e.g. `global[name]`) in the main process. -## remote.process +### `remote.process` Returns the `process` object in the main process. This is the same as -`remote.getGlobal('process')`, but gets cached. +`remote.getGlobal('process')` but is cached. From e6e09a8a7cd1911a964e018e24b9ab7d37d1dad5 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 22:24:54 -0700 Subject: [PATCH 18/59] Standardize screen --- docs/api/screen.md | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/docs/api/screen.md b/docs/api/screen.md index bc93ec5f892b..c22530ca8d0a 100644 --- a/docs/api/screen.md +++ b/docs/api/screen.md @@ -1,11 +1,14 @@ # screen -Gets various info about screen size, displays, cursor position, etc. You should -not use this module until the `ready` event of `app` module gets emitted. +The `screen` module retrieves information about screen size, displays, cursor +position, etc. You should not use this module until the `ready` event of the +`app` module is emitted. `screen` is an [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter). -Make sure to note that in the renderer / DevTools, `window.screen` is a reserved DOM property, so writing `screen = require('screen')` won't work. In our examples below, we use `atomScreen` as the variable name instead. +**Note**: In the renderer / DevTools, `window.screen` is a reserved +DOM property, so writing `var screen = require('screen')` will not work. In our +examples below, we use `atomScreen` as the variable name instead. An example of creating a window that fills the whole screen: @@ -50,43 +53,57 @@ app.on('ready', function() { }); ``` -## Event: display-added +## Events + +The `screen` module emits the following events: + +### Event: 'display-added' + +Returns: * `event` Event * `newDisplay` Object Emitted when `newDisplay` has been added. -## Event: display-removed +### Event: 'display-removed' + +Returns: * `event` Event * `oldDisplay` Object Emitted when `oldDisplay` has been removed. -## Event: display-metrics-changed +### Event: 'display-metrics-changed' + +Returns: * `event` Event * `display` Object * `changedMetrics` Array -Emitted when a `display` has one or more metrics changed, `changedMetrics` is +Emitted when one or more metrics change in a `display`. The `changedMetrics` is an array of strings that describe the changes. Possible changes are `bounds`, `workArea`, `scaleFactor` and `rotation`. -## screen.getCursorScreenPoint() +## Methods + +The `screen` module has the following methods: + +### `screen.getCursorScreenPoint()` Returns the current absolute position of the mouse pointer. -## screen.getPrimaryDisplay() +### `screen.getPrimaryDisplay()` Returns the primary display. -## screen.getAllDisplays() +### `screen.getAllDisplays()` Returns an array of displays that are currently available. -## screen.getDisplayNearestPoint(point) +### `screen.getDisplayNearestPoint(point)` * `point` Object * `x` Integer @@ -94,7 +111,7 @@ Returns an array of displays that are currently available. Returns the display nearest the specified point. -## screen.getDisplayMatching(rect) +### `screen.getDisplayMatching(rect)` * `rect` Object * `x` Integer From a2cc936a3b01f23b6f9c632307eda95f4bcf620f Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 22:28:30 -0700 Subject: [PATCH 19/59] Standardize shell --- docs/api/shell.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/api/shell.md b/docs/api/shell.md index f0848875a975..662fa588f3f0 100644 --- a/docs/api/shell.md +++ b/docs/api/shell.md @@ -2,38 +2,43 @@ The `shell` module provides functions related to desktop integration. -An example of opening a URL in default browser: +An example of opening a URL in the user's default browser: ```javascript var shell = require('shell'); + shell.openExternal('https://github.com'); ``` -## shell.showItemInFolder(fullPath) +## Methods + +The `shell` module has the following methods: + +### `shell.showItemInFolder(fullPath)` * `fullPath` String Show the given file in a file manager. If possible, select the file. -## shell.openItem(fullPath) +### `shell.openItem(fullPath)` * `fullPath` String Open the given file in the desktop's default manner. -## shell.openExternal(url) +### `shell.openExternal(url)` * `url` String Open the given external protocol URL in the desktop's default manner. (For -example, mailto: URLs in the default mail user agent.) +example, mailto: URLs in the user's default mail agent.) -## shell.moveItemToTrash(fullPath) +### `shell.moveItemToTrash(fullPath)` * `fullPath` String -Move the given file to trash and returns boolean status for the operation. +Move the given file to trash and returns a boolean status for the operation. -## shell.beep() +### `shell.beep()` Play the beep sound. From e8a04981bbafd2ed707b1cc3be168d1f9762d128 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 22:46:31 -0700 Subject: [PATCH 20/59] Standardize synopsis --- docs/api/synopsis.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/api/synopsis.md b/docs/api/synopsis.md index 10daf2b68e78..4634151bfbec 100644 --- a/docs/api/synopsis.md +++ b/docs/api/synopsis.md @@ -1,18 +1,22 @@ # Synopsis -All of [node.js's built-in modules](http://nodejs.org/api/) are available in -Electron, and third-party node modules are fully supported too (including the -[native modules](../tutorial/using-native-node-modules.md)). +All of [Node.js's built-in modules](http://nodejs.org/api/) are available in +Electron and third-party node modules also fully supported as well (including +the [native modules](../tutorial/using-native-node-modules.md)). Electron also provides some extra built-in modules for developing native desktop applications. Some modules are only available on the main process, some -are only available on the renderer process, and some can be used on both processes. -The basic rule is: if a module is GUI or low-level system related, then it should -be only available on the main process. You need to be familiar with the concept of +are only available on the renderer process (web page), and some can be used on +both processes. + +The basic rule is: if a module is +[GUI](https://en.wikipedia.org/wiki/Graphical_user_interface) or low-level +system related, then it should be only available on the main process. You need +to be familiar with the concept of [main process vs. renderer process](../tutorial/quick-start.md#the-main-process) scripts to be able to use those modules. -The main process script is just like a normal `node.js` script: +The main process script is just like a normal Node.js script: ```javascript var app = require('app'); @@ -26,7 +30,7 @@ app.on('ready', function() { }); ``` -The web page is no different than a normal web page, except for the extra +The render process is no different than a normal web page, except for the extra ability to use node modules: ```html From b1fc18f405a77aad212123888ed384f6583afe18 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 22:46:39 -0700 Subject: [PATCH 21/59] Standardize tray --- docs/api/tray.md | 86 ++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 46 deletions(-) diff --git a/docs/api/tray.md b/docs/api/tray.md index a67772746128..c9ebf20543fe 100644 --- a/docs/api/tray.md +++ b/docs/api/tray.md @@ -1,6 +1,6 @@ -# tray +# Tray -A `Tray` represents an icon in operating system's notification area, it is +A `Tray` represents an icon in an operating system's notification area, it is usually attached with a context menu. ```javascript @@ -25,26 +25,33 @@ app.on('ready', function(){ __Platform limitations:__ -* On Linux app indicator will be used if it is supported, otherwise +* On Linux the app indicator will be used if it is supported, otherwise `GtkStatusIcon` will be used instead. * On Linux distributions that only have app indicator support, you have to - install `libappindicator1` to make tray icon work. -* App indicator will only be showed when it has context menu. -* When app indicator is used on Linux, `clicked` event is ignored. + install `libappindicator1` to make the tray icon work. +* App indicator will only be shown when it has a context menu. +* When app indicator is used on Linux, the `clicked` event is ignored. -So if you want to keep exact same behaviors on all platforms, you should not -rely on `clicked` event and always attach a context menu to the tray icon. +If you want to keep exact same behaviors on all platforms, you should not +rely on the `clicked` event and always attach a context menu to the tray icon. ## Class: Tray `Tray` is an [EventEmitter][event-emitter]. -### new Tray(image) +### `new Tray(image)` * `image` [NativeImage](native-image.md) Creates a new tray icon associated with the `image`. +## Events + +The `Tray` module emits the following events: + +**Note:** Some events are only available on specific operating systems and are +labeled as such. + ### Event: 'clicked' * `event` Event @@ -52,7 +59,7 @@ Creates a new tray icon associated with the `image`. * `shiftKey` Boolean * `ctrlKey` Boolean * `metaKey` Boolean -* `bounds` Object - the bounds of tray icon +* `bounds` Object - the bounds of tray icon. * `x` Integer * `y` Integer * `width` Integer @@ -62,14 +69,14 @@ Emitted when the tray icon is clicked. __Note:__ The `bounds` payload is only implemented on OS X and Windows. -### Event: 'right-clicked' +### Event: 'right-clicked' _OS X_ _Windows_ * `event` Event * `altKey` Boolean * `shiftKey` Boolean * `ctrlKey` Boolean * `metaKey` Boolean -* `bounds` Object - the bounds of tray icon +* `bounds` Object - the bounds of tray icon. * `x` Integer * `y` Integer * `width` Integer @@ -77,9 +84,7 @@ __Note:__ The `bounds` payload is only implemented on OS X and Windows. Emitted when the tray icon is right clicked. -__Note:__ This is only implemented on OS X and Windows. - -### Event: 'double-clicked' +### Event: 'double-clicked' _OS X_ _Windows_ * `event` Event * `altKey` Boolean @@ -94,75 +99,68 @@ __Note:__ This is only implemented on OS X and Windows. Emitted when the tray icon is double clicked. -__Note:__ This is only implemented on OS X and Windows. - -### Event: 'balloon-show' +### Event: 'balloon-show' _Windows_ Emitted when the tray balloon shows. -__Note:__ This is only implemented on Windows. - -### Event: 'balloon-clicked' +### Event: 'balloon-clicked' _Windows_ Emitted when the tray balloon is clicked. -__Note:__ This is only implemented on Windows. - -### Event: 'balloon-closed' +### Event: 'balloon-closed' _Windows_ Emitted when the tray balloon is closed because of timeout or user manually closes it. -__Note:__ This is only implemented on Windows. - -### Event: 'drop-files' +### Event: 'drop-files' _OS X_ * `event` * `files` Array - the file path of dropped files. Emitted when dragged files are dropped in the tray icon. -__Note:__ This is only implemented on OS X. +## Methods -### Tray.destroy() +The `Tray` module has the following methods: + +**Note**: Some methods are only available on specific operating systems and area +labeled as such. + +### `Tray.destroy()` Destroys the tray icon immediately. -### Tray.setImage(image) +### `Tray.setImage(image)` * `image` [NativeImage](native-image.md) Sets the `image` associated with this tray icon. -### Tray.setPressedImage(image) +### `Tray.setPressedImage(image)` _OS X_ * `image` [NativeImage](native-image.md) Sets the `image` associated with this tray icon when pressed on OS X. -### Tray.setToolTip(toolTip) +### `Tray.setToolTip(toolTip)` * `toolTip` String Sets the hover text for this tray icon. -### Tray.setTitle(title) +### `Tray.setTitle(title)` _OS X_ * `title` String Sets the title displayed aside of the tray icon in the status bar. -__Note:__ This is only implemented on OS X. - -### Tray.setHighlightMode(highlight) +### `Tray.setHighlightMode(highlight)` _OS X_ * `highlight` Boolean Sets whether the tray icon is highlighted when it is clicked. -__Note:__ This is only implemented on OS X. - -### Tray.displayBalloon(options) +### `Tray.displayBalloon(options)` _Windows_ * `options` Object * `icon` [NativeImage](native-image.md) @@ -171,19 +169,15 @@ __Note:__ This is only implemented on OS X. Displays a tray balloon. -__Note:__ This is only implemented on Windows. +### `Tray.popUpContextMenu([position])` _OS X_ _Windows_ -### Tray.popUpContextMenu([position]) - -* `position` Object - The pop position +* `position` Object (optional)- The pop up position. * `x` Integer * `y` Integer The `position` is only available on Windows, and it is (0, 0) by default. -__Note:__ This is only implemented on OS X and Windows. - -### Tray.setContextMenu(menu) +### `Tray.setContextMenu(menu)` * `menu` Menu From 39e3506add35f63002625a08edb716cebeb94b3f Mon Sep 17 00:00:00 2001 From: appetizermonster Date: Sat, 29 Aug 2015 18:04:30 +0900 Subject: [PATCH 22/59] Fix typo --- docs/api/frameless-window.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/frameless-window.md b/docs/api/frameless-window.md index 8d5c578914c7..a326bbd8c196 100644 --- a/docs/api/frameless-window.md +++ b/docs/api/frameless-window.md @@ -32,7 +32,7 @@ var win = new BrowserWindow({ transparent: true, frame: false }); * The `blur` filter only applies to the web page, so there is no way to apply blur effect to the content below the window (i.e. other applications open on the user's system). -* On Windows operation shystems, transparent windows will not work when DWM is +* On Windows operation systems, transparent windows will not work when DWM is disabled. * On Linux users have to put `--enable-transparent-visuals --disable-gpu` in the command line to disable GPU and allow ARGB to make transparent window, From 8757da6c4742c19d7008cf35cfdc5883665c2c4f Mon Sep 17 00:00:00 2001 From: Robo Date: Sat, 29 Aug 2015 19:20:09 +0530 Subject: [PATCH 23/59] renderer: send referrer for all naviagtions --- atom/renderer/atom_renderer_client.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 04a89fed3889..86c9eb1cdeb6 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -229,6 +229,7 @@ bool AtomRendererClient::ShouldFork(blink::WebFrame* frame, // FIXME We only support GET here because http method will be ignored when // the OpenURLFromTab is triggered, which means form posting would not work, // we should solve this by patching Chromium in future. + *send_referrer = true; return http_method == "GET"; } From cfc5ecb05d68c33ebae71c288b2d7a6a966a3015 Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Sat, 29 Aug 2015 20:05:15 +0300 Subject: [PATCH 24/59] Update web-frame.md phrasing --- docs/api/web-frame.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api/web-frame.md b/docs/api/web-frame.md index 810c31a4ecdd..82d5fcc49d79 100644 --- a/docs/api/web-frame.md +++ b/docs/api/web-frame.md @@ -1,6 +1,7 @@ # web-frame -The `web-frame` module can custom the rendering of current web page. +The `web-frame` module allows you to customize the rendering of the current +web page. An example of zooming current page to 200%. From eab88ea09cc49a5180269f615393e349fa3589d8 Mon Sep 17 00:00:00 2001 From: Fritz Lin Date: Sun, 30 Aug 2015 22:53:40 +0800 Subject: [PATCH 25/59] Setting up docs translation in Chinese :+1: --- README.md | 1 + docs-translations/cn/README.md | 70 ++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 docs-translations/cn/README.md diff --git a/README.md b/README.md index ace7116c469a..32e5da2fafb3 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ contains documents describing how to build and contribute to Electron. - [Korean](https://github.com/atom/electron/tree/master/docs-translations/ko) - [Japanese](https://github.com/atom/electron/tree/master/docs-translations/jp) - [Spanish](https://github.com/atom/electron/tree/master/docs-translations/es) +- [Chinese](https://github.com/atom/electron/tree/master/docs-translations/cn) ## Community diff --git a/docs-translations/cn/README.md b/docs-translations/cn/README.md new file mode 100644 index 000000000000..124d030c46ee --- /dev/null +++ b/docs-translations/cn/README.md @@ -0,0 +1,70 @@ +## å‘导 + +* [应用部署](tutorial/application-distribution.md) +* [应用打包](tutorial/application-packaging.md) +* [使用原生模å—](tutorial/using-native-node-modules.md) +* [主进程调试](tutorial/debugging-main-process.md) +* [使用 Selenium å’Œ WebDriver](tutorial/using-selenium-and-webdriver.md) +* [调试工具扩展](tutorial/devtools-extension.md) +* [使用 PepperFlash æ’件](tutorial/using-pepper-flash-plugin.md) + +## 教程 + +* [快速入门](tutorial/quick-start.md) +* [æ¡Œé¢çŽ¯å¢ƒé›†æˆ](tutorial/desktop-environment-integration.md) +* [在线/离线事件探测](tutorial/online-offline-events.md) + +## API文档 + +* [简介](api/synopsis.md) +* [进程对象](api/process.md) +* [支æŒçš„Chrome命令行开关](api/chrome-command-line-switches.md) + +定制的DOM元素: + +* [`File`对象](api/file-object.md) +* [``标签](api/web-view-tag.md) +* [`window.open`函数](api/window-open.md) + +主进程å¯ç”¨çš„模å—: + +* [app](api/app.md) +* [auto-updater](api/auto-updater.md) +* [browser-window](api/browser-window.md) +* [content-tracing](api/content-tracing.md) +* [dialog](api/dialog.md) +* [global-shortcut](api/global-shortcut.md) +* [ipc (main process)](api/ipc-main-process.md) +* [menu](api/menu.md) +* [menu-item](api/menu-item.md) +* [power-monitor](api/power-monitor.md) +* [power-save-blocker](api/power-save-blocker.md) +* [protocol](api/protocol.md) +* [session](api/session.md) +* [webContents](api/web-contents.md) +* [tray](api/tray.md) + +渲染进程(网页)å¯ç”¨çš„模å—: + +* [ipc (renderer)](api/ipc-renderer.md) +* [remote](api/remote.md) +* [web-frame](api/web-frame.md) + +两ç§è¿›ç¨‹éƒ½å¯ç”¨çš„模å—: + +* [clipboard](api/clipboard.md) +* [crash-reporter](api/crash-reporter.md) +* [native-image](api/native-image.md) +* [screen](api/screen.md) +* [shell](api/shell.md) + +## å¼€å‘ + +* [ç¼–ç è§„范](development/coding-style.md) +* [æºç æ–‡ä»¶ç»“æž„](development/source-code-directory-structure.md) +* [与 NW.js (原å node-webkit) 在技术上的差异](development/atom-shell-vs-node-webkit.md) +* [构建系统概况](development/build-system-overview.md) +* [构建步骤 (Mac)](development/build-instructions-mac.md) +* [构建步骤 (Windows)](development/build-instructions-windows.md) +* [构建步骤 (Linux)](development/build-instructions-linux.md) +* [在调试中使用 SymbolServer](development/setting-up-symbol-server.md) From 9ee063ca14ce62955bf90ab0c9f6edb7ad4c86c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Mon, 31 Aug 2015 00:07:36 +0200 Subject: [PATCH 26/59] Add section about server implementations --- docs/api/auto-updater.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api/auto-updater.md b/docs/api/auto-updater.md index 4e1dc5e0deb4..3901e1be2062 100644 --- a/docs/api/auto-updater.md +++ b/docs/api/auto-updater.md @@ -98,6 +98,10 @@ appropriate format. `pub_date` (if present) must be formatted according to ISO 8601. +## Update server implementations + +[Nuts](https://github.com/GitbookIO/nuts) is an open source implementation of the update server described above, it integrates beautifully with GitHub releases. Nuts manages downloads and updates, it’s compatible with `Squirrel.Mac` and `Squirrel.Windows` so you get cross-platform support out of the box. + ## Events The `autoUpdater` object emits the following events: From 9c46be9d479a51767f7a58ca9a1525ac669e0886 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Mon, 31 Aug 2015 09:52:28 +0900 Subject: [PATCH 27/59] Translate styleguide.md --- docs-translations/ko/styleguide.md | 73 ++++++++++++++---------------- 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/docs-translations/ko/styleguide.md b/docs-translations/ko/styleguide.md index 065d37f5cd17..e63a016e8780 100644 --- a/docs-translations/ko/styleguide.md +++ b/docs-translations/ko/styleguide.md @@ -1,61 +1,55 @@ -# Electron Documentation Styleguide +# Electron 문서 ìŠ¤íƒ€ì¼ ê°€ì´ë“œ -Find the appropriate section for your task: [reading Electron documentation](#) -or [writing Electron documentation](#). +[Electron 문서 ì½ê¸°](#) 와 [Electron 문서 작성하기](#) 중 ì ë‹¹ížˆ 필요한 ë¶€ë¶„ì„ ì°¾ì•„ 참고하세요: -## Writing Electron Documentation +## Electron 문서 작성하기 -These are the ways that we construct the Electron documentation. +Electron 문서를 작성하는 ê·œì¹™ì€ ë‹¤ìŒê³¼ 같습니다. -- Maximum one `h1` title per page. -- Use `bash` instead of `cmd` in code blocks (because of syntax highlighter). -- Doc `h1` titles should match object name (i.e. `browser-window` ¡æ - `BrowserWindow`). - - Hyphen separated filenames, however, are fine. -- No headers following headers, add at least a one-sentence description. -- Methods headers are wrapped in `code` ticks. -- Event headers are wrapped in single 'quotation' marks. -- No nesting lists more than 2 levels (unfortunately because of markdown - renderer). -- Add section titles: Events, Class Methods and Instance Methods. -- Use 'will' over 'would' when describing outcomes. -- Events and methods are `h3` headers. -- Optional arguments written as `function (required[, optional])`. -- Optional arguments are denoted when called out in list. -- Line length is 80-column wrapped. -- Platform specific methods are noted in italics following method header. +- `h1` ì œëª©ì€ íŽ˜ì´ì§€ë‹¹ í•œ 개만 사용할 수 있습니다. +- 코드 블럭ì—ì„œ í„°ë¯¸ë„ ì–¸ì–´ ì„ íƒì‹œ `cmd` 대신 `bash`를 사용합니다. (syntax highlighter를 사용하기 위해서) +- ë¬¸ì„œì˜ `h1` ì œëª©ì€ ë°˜ë“œì‹œ 현재 ê°ì²´ ì´ë¦„ê³¼ 같게 해야 합니다. (예시: `browser-window` → `BrowserWindow`) + - 하ì´í”ˆ(-)으로 구분ë˜ì—ˆë˜ 어떻게 ë˜ì—ˆë˜ ê°„ì— ì˜ˆì‹œì™€ ê°™ì´ ìž‘ì„±í•©ë‹ˆë‹¤. +- í—¤ë” ë°‘ì— í—¤ë”를 바로 사용하지 않습니다. í•œ 줄ì´ë¼ë„ 좋으니 í—¤ë”와 í—¤ë” ì‚¬ì´ì— 설명 추가합니다. +- 메서드 í—¤ë”는 `code` 틱으로 표시합니다. +- ì´ë²¤íŠ¸ í—¤ë”는 í•œ '따옴표'ë¡œ 표시합니다. +- 리스트를 2 단계 ì´ìƒ 중첩하지 않습니다. (안타ê¹ê²Œë„ markdown ëžœë”러가 지ì›í•˜ì§€ 않습니다) +- ì„¹ì…˜ì— ëŒ€í•œ ì œëª©ì„ ì¶”ê°€í•©ë‹ˆë‹¤: Events, Class 메서드 그리고 ì¸ìŠ¤í„´ìŠ¤ 메서드등. +- ì–´ë–¤ '것'ì˜ ì‚¬ìš© 결과를 설명할 ë•Œ 'ë  ê²ƒìž…ë‹ˆë‹¤' 형ì‹ì„ 사용하여 설명합니다. +- ì´ë²¤íŠ¸ì™€ 메서드ì—는 `h3` í—¤ë”를 사용합니다. +- ì„ íƒì  ì¸ìˆ˜ëŠ” `function (required[, optional])` 형ì‹ìœ¼ë¡œ 작성합니다. +- ì„ íƒì  ì¸ìˆ˜ëŠ” 목ë¡ì—ì„œ 호출ë˜ë©´ 표시합니다. +- ë¬¸ìž¥ì˜ ê¸¸ì´ëŠ” í•œ 줄당 80 ì¹¸ì„ ìœ ì§€í•©ë‹ˆë‹¤. +- í”Œëž«í¼ íŠ¹ì • 메서드 í—¤ë”는 ì´íƒˆë¦­ì²´ë¡œ 표시합니다. - ```### `method(foo, bar)` _OS X_``` -## Reading Electron Documentation +## Electron 문서 ì½ê¸° -Here are some tips for understanding Electron documentation syntax. +Electron 문서 구조를 ì´í•´í•˜ëŠ” ë° ì°¸ê³ í•  수 있는 유용한 ë„움ë§ìž…니다. -### Methods +### 메서드 -An example of [method](https://developer.mozilla.org/en-US/docs/Glossary/Method) -documentation: +[메서드](https://developer.mozilla.org/en-US/docs/Glossary/Method) ë¬¸ì„œì˜ ì˜ˆì œìž…ë‹ˆë‹¤: --- `methodName(required[, optional]))` -* `require` String, **required** +* `require` String, **필수** * `optional` Integer --- -The method name is followed by the arguments it takes. Optional arguments are -notated by brackets surrounding the optional argument as well as the comma -required if this optional argument follows another argument. +메서드 ì´ë¦„ì€ ì¸ìˆ˜ê°€ ë¬´ì—‡ì„ ë°›ëŠ”ì§€ì— ë”°ë¼ ê²°ì •ë©ë‹ˆë‹¤. ì„ íƒì  ì¸ìˆ˜ëŠ” 브ë¼ì¼“([, ])으로 묶어 +ì´ ì¸ìˆ˜ê°€ 다른 ì¸ìˆ˜ë’¤ì— ì„ íƒì ìœ¼ë¡œ 사용할 수 있다는 ê²ƒì„ ì„¤ëª…í•©ë‹ˆë‹¤. -Below the method is more detailed information on each of the arguments. The type -of argument is notated by either the common types: [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object), [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) -or a custom type like Electron's [`webContent`](api/web-content.md). +ë©”ì„œë“œì˜ ë°‘ì—ì„  ê° ì¸ìˆ˜ì— 대해 ìžì„¸í•œ ì„¤ëª…ì„ í•©ë‹ˆë‹¤. ì¸ìˆ˜ì˜ íƒ€ìž…ì€ ì¼ë°˜ì ì¸ 타입 중 하나를 받거나: +[`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object), [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) +Electronì˜ [`webContent`](api/web-content.md)ê°™ì€ ì»¤ìŠ¤í…€ íƒ€ìž…ì„ ë°›ìŠµë‹ˆë‹¤. ### Events -An example of [event](https://developer.mozilla.org/en-US/docs/Web/API/Event) -documentation: +[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) ë¬¸ì„œì˜ ì˜ˆì œìž…ë‹ˆë‹¤: --- @@ -67,12 +61,11 @@ Returns: --- -The event is a string that is used after a `.on` listener method. If it returns -a value it and its type is noted below. If you were to listen and respond to -this event it might look something like this: +ì´ë²¤íŠ¸ëŠ” `.on` 리스너 메서드로 사용할 수 있습니다. 만약 ì´ë²¤íŠ¸ì—ì„œ ê°’ì„ ë°˜í™˜í•œë‹¤ë©´ 문서ì—ì„œ í‘œì‹œëœ ëŒ€ë¡œ +ì¼ì •í•œ íƒ€ìž…ì˜ ê°’ì„ ë°˜í™˜í•©ë‹ˆë‹¤. ì´ë²¤íŠ¸ë¥¼ 처리하거나 ì‘답하려 한다면 다ìŒê³¼ ê°™ì´ ì‚¬ìš©í•  수 있습니다: ```javascript Alarm.on('wake-up', function(time) { console.log(time) }) -``` \ No newline at end of file +``` From 3d4f0dfc44003956dc1abbac5e8fe87ef82b56a1 Mon Sep 17 00:00:00 2001 From: Fritz Lin Date: Mon, 31 Aug 2015 11:02:37 +0800 Subject: [PATCH 28/59] Move cn to zh-CN for future traditional Chinese translations ref #2649 --- README.md | 2 +- docs-translations/{cn => zh-CN}/README.md | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename docs-translations/{cn => zh-CN}/README.md (100%) diff --git a/README.md b/README.md index 32e5da2fafb3..7f398cbd943b 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ contains documents describing how to build and contribute to Electron. - [Korean](https://github.com/atom/electron/tree/master/docs-translations/ko) - [Japanese](https://github.com/atom/electron/tree/master/docs-translations/jp) - [Spanish](https://github.com/atom/electron/tree/master/docs-translations/es) -- [Chinese](https://github.com/atom/electron/tree/master/docs-translations/cn) +- [Simplified Chinese](https://github.com/atom/electron/tree/master/docs-translations/zh-CN) ## Community diff --git a/docs-translations/cn/README.md b/docs-translations/zh-CN/README.md similarity index 100% rename from docs-translations/cn/README.md rename to docs-translations/zh-CN/README.md From 2c6210cf9c6487d812010102edd789952dba0dde Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Sun, 30 Aug 2015 20:52:37 -0700 Subject: [PATCH 29/59] Update code example --- docs/api/native-image.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/api/native-image.md b/docs/api/native-image.md index 03b1a309113e..467940c4f74e 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -115,7 +115,9 @@ Creates a new `NativeImage` instance from `dataUrl`. The following methods are available on instances of `nativeImage` ```javascript -var image = nativeImage.createFromPath('/Users/somebody/images/icon.png') +var NativeImage = require('native-image'); + +var image = NativeImage.createFromPath('/Users/somebody/images/icon.png'); ``` ### `image.toPng()` From 254cdc0e6ca4b467f7eda28b4083d0bfc669e532 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Sun, 30 Aug 2015 20:52:46 -0700 Subject: [PATCH 30/59] Text edits --- docs/api/native-image.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/api/native-image.md b/docs/api/native-image.md index 467940c4f74e..4b90fcfce612 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -29,15 +29,15 @@ On Windows, you can also load `ICO` icon from a file path. ## High resolution image On platforms that have high-DPI support, you can append `@2x` after image's -file name's base name to mark it as a high resolution image. +base filename to mark it as a high resolution image. For example if `icon.png` is a normal image that has standard resolution, then `icon@2x.png` would be treated as a high resolution image that has double DPI density. -If you want to support displays with different DPI density at the same time, you -can put images with different sizes in the same folder, and use the filename -without DPI suffixes, like this: +If you want to support displays with different DPI densities at the same time, +you can put images with different sizes in the same folder and use the filename +without DPI suffixes. For example: ```text images/ @@ -51,7 +51,7 @@ images/ var appIcon = new Tray('/Users/somebody/images/icon.png'); ``` -Following suffixes as DPI denses are also supported: +Following suffixes for DPI are also supported: * `@1x` * `@1.25x` @@ -71,13 +71,13 @@ Template images consist of black and clear colors (and an alpha channel). Template images are not intended to be used as standalone images and are usually mixed with other content to create the desired final appearance. -The most common case is to use template image for menu bar icon so it can adapt -to both light and dark menu bars. +The most common case is to use template images for a menu bar icon so it can +adapt to both light and dark menu bars. -Template image is only supported on OS X. +**Note**: Template image is only supported on OS X. To mark an image as a template image, its filename should end with the word -`Template`, examples are: +`Template`. For example: * `xxxTemplate.png` * `xxxTemplate@2x.png` @@ -112,7 +112,7 @@ Creates a new `NativeImage` instance from `dataUrl`. ## Instance Methods -The following methods are available on instances of `nativeImage` +The following methods are available on instances of `nativeImage`: ```javascript var NativeImage = require('native-image'); From c67268a74f088354e8ed4f9e2d7880120af3c690 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Mon, 31 Aug 2015 14:48:47 +0900 Subject: [PATCH 31/59] Improve grammar, update as upstream --- README-ko.md | 2 +- docs-translations/ko/README.md | 8 ++- docs-translations/ko/api/clipboard.md | 54 +++++++++-------- docs-translations/ko/api/content-tracing.md | 51 ++++++++-------- docs-translations/ko/api/crash-reporter.md | 59 +++++++++++-------- docs-translations/ko/api/dialog.md | 59 ++++++++++--------- docs-translations/ko/api/file-object.md | 7 ++- docs-translations/ko/api/frameless-window.md | 44 +++++++------- docs-translations/ko/api/menu-item.md | 2 +- docs-translations/ko/api/menu.md | 4 +- docs-translations/ko/api/remote.md | 56 ++++++++++++++---- docs-translations/ko/api/web-frame.md | 11 +++- docs-translations/ko/api/window-open.md | 6 +- .../development/build-instructions-windows.md | 9 +++ .../development/setting-up-symbol-server.md | 2 +- docs-translations/ko/styleguide.md | 4 +- .../ko/tutorial/application-packaging.md | 2 +- .../ko/tutorial/using-native-node-modules.md | 24 ++++---- docs/api/content-tracing.md | 4 +- 19 files changed, 237 insertions(+), 171 deletions(-) diff --git a/README-ko.md b/README-ko.md index bbe1333cf553..00cfe43732de 100644 --- a/README-ko.md +++ b/README-ko.md @@ -36,7 +36,7 @@ npm install electron-prebuilt --save-dev [Docs](https://github.com/atom/electron/tree/master/docs/README.md)ì— ê°œë°œ ê°€ì´ë“œì™€ API ë ˆí¼ëŸ°ìŠ¤ê°€ 있습니다. Electronì„ ë¹Œë“œ 하는 방법과 프로ì íŠ¸ì— 기여하는 ë°©ë²•ë„ ë¬¸ì„œì— í¬í•¨ë˜ì–´ 있으니 참고하시기 ë°”ëžë‹ˆë‹¤. -## 참조 문서(번역) +## 참조 문서 (번역) - [한국어](https://github.com/atom/electron/tree/master/docs-translations/ko) - [ì¼ë³¸ì–´](https://github.com/atom/electron/tree/master/docs-translations/jp) diff --git a/docs-translations/ko/README.md b/docs-translations/ko/README.md index 51bf0a36d07f..89112b11c835 100644 --- a/docs-translations/ko/README.md +++ b/docs-translations/ko/README.md @@ -20,11 +20,11 @@ * [프로세스 ê°ì²´](api/process.md) * [í¬ë¡¬ Command-Line 스위치 지ì›](api/chrome-command-line-switches.md) -커스텀 DOM Element: +커스텀 DOM elements: * [`File` ê°ì²´](api/file-object.md) * [`` 태그](api/web-view-tag.md) -* [`window.open` 함수](api/window-open.md) +* [`window.open` 메서드](api/window-open.md) ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¥¼ 위한 모듈들: @@ -40,6 +40,8 @@ * [power-monitor](api/power-monitor.md) * [power-save-blocker](api/power-save-blocker.md) * [protocol](api/protocol.md) +* [session](api/session.md) +* [webContents](api/web-contents.md) * [tray](api/tray.md) ëžœë”러 프로세스를 위한 모듈들 (웹 페ì´ì§€): @@ -60,7 +62,7 @@ * [코딩 스타ì¼](development/coding-style.md) * [소스 코드 디렉터리 구조](development/source-code-directory-structure.md) -* [NW.js와 기술ì ìœ¼ë¡œ ë‹¤ë¥¸ì  (ì´ì „ node-webkit)](development/atom-shell-vs-node-webkit.md) +* [NW.js(node-webkit)와 기술ì ìœ¼ë¡œ 다른ì ](development/atom-shell-vs-node-webkit.md) * [빌드 시스템 개요](development/build-system-overview.md) * [빌드 설명서 (Mac)](development/build-instructions-mac.md) * [빌드 설명서 (Windows)](development/build-instructions-windows.md) diff --git a/docs-translations/ko/api/clipboard.md b/docs-translations/ko/api/clipboard.md index a6b29c2a377f..5143a4c3b113 100644 --- a/docs-translations/ko/api/clipboard.md +++ b/docs-translations/ko/api/clipboard.md @@ -1,6 +1,6 @@ # clipboard -`clipboard`는 복사/붙여넣기 ìž‘ì—…ì„ ìˆ˜í–‰í•˜ëŠ” ë°©ë²•ì„ ì œê³µí•©ë‹ˆë‹¤. ë‹¤ìŒ ì˜ˆì œëŠ” í´ë¦½ë³´ë“œì— 문ìžì—´ì„ ì”니다: +`clipboard` ëª¨ë“ˆì€ ë³µì‚¬/붙여넣기 ìž‘ì—…ì„ ìˆ˜í–‰í•˜ëŠ” ë°©ë²•ì„ ì œê³µí•©ë‹ˆë‹¤. ë‹¤ìŒ ì˜ˆì œëŠ” í´ë¦½ë³´ë“œì— 문ìžì—´ì„ ì”니다: ```javascript var clipboard = require('clipboard'); @@ -15,59 +15,65 @@ clipboard.writeText('Example String', 'selection'); console.log(clipboard.readText('selection')); ``` -## clipboard.readText([type]) +## Methods -* `type` String +`clipboard` ëª¨ë“ˆì€ ë‹¤ìŒê³¼ ê°™ì€ ë©”ì„œë“œë¥¼ 가지고 있습니다: + +**알림:** Experimental 마í¬ê°€ ë¶™ì€ API는 실험ì ì¸ 기능ì´ë©° 차후 최신 버전ì—ì„œ ì œê±°ë  ìˆ˜ 있습니다. + +### `clipboard.readText([type])` + +* `type` String (optional) í´ë¦½ë³´ë“œ 컨í…츠를 `plain text`ë¡œ 반환합니다. -## clipboard.writeText(text[, type]) +### `clipboard.writeText(text[, type])` * `text` String -* `type` String +* `type` String (optional) í´ë¦½ë³´ë“œì— `plain text`ë¡œ 문ìžì—´ì„ ì”니다. -## clipboard.readHtml([type]) +### `clipboard.readHtml([type])` -* `type` String +* `type` String (optional) í´ë¦½ë³´ë“œ 컨í…츠를 `markup`으로 반환합니다. -## clipboard.writeHtml(markup[, type]) +### `clipboard.writeHtml(markup[, type])` * `markup` String -* `type` String +* `type` String (optional) í´ë¦½ë³´ë“œì— `markup`으로 ì”니다. -## clipboard.readImage([type]) +### `clipboard.readImage([type])` -* `type` String +* `type` String (optional) í´ë¦½ë³´ë“œë¡œë¶€í„° [NativeImage](native-image.md)ë¡œ ì´ë¯¸ì§€ë¥¼ ì½ì–´ë“¤ìž…니다. -## clipboard.writeImage(image[, type]) +### `clipboard.writeImage(image[, type])` * `image` [NativeImage](native-image.md) -* `type` String +* `type` String (optional) í´ë¦½ë³´ë“œì— `image`를 ì”니다. -## clipboard.clear([type]) +### `clipboard.clear([type])` -* `type` String +* `type` String (optional) í´ë¦½ë³´ë“œì— ì €ìž¥ëœ ëª¨ë“  컨í…츠를 삭제합니다. -## clipboard.availableFormats([type]) +### clipboard.availableFormats([type]) í´ë¦½ë³´ë“œì˜ `type`ì— í•´ë‹¹í•˜ëŠ” 지ì›í•˜ëŠ” `format`ì„ ë¬¸ìžì—´ë¡œ 반환합니다. -## clipboard.has(data[, type]) +### `clipboard.has(data[, type])` * `data` String -* `type` String +* `type` String (optional) í´ë¦½ë³´ë“œê°€ 지정한 `data`ì˜ í˜•ì‹ì„ 지ì›í•˜ëŠ”지 확ì¸í•©ë‹ˆë‹¤. @@ -76,24 +82,20 @@ var clipboard = require('clipboard'); console.log(clipboard.has('

selection

')); ``` -**알림:** ì´ API는 실험ì ì¸ 기능ì´ë©° 차후 최신버전ì—ì„œ ì œì™¸ë  ìˆ˜ 있습니다. - -## clipboard.read(data[, type]) +### `clipboard.read(data[, type])` _Experimental_ * `data` String -* `type` String +* `type` String (optional) í´ë¦½ë³´ë“œë¡œë¶€í„° `data`를 ì½ì–´ë“¤ìž…니다. -**알림:** ì´ API는 실험ì ì¸ 기능ì´ë©° 차후 최신버전ì—ì„œ ì œì™¸ë  ìˆ˜ 있습니다. - -## clipboard.write(data[, type]) +### `clipboard.write(data[, type])` _Experimental_ * `data` Object * `text` String * `html` String * `image` [NativeImage](native-image.md) -* `type` String +* `type` String (optional) ```javascript var clipboard = require('clipboard'); diff --git a/docs-translations/ko/api/content-tracing.md b/docs-translations/ko/api/content-tracing.md index 1ec019d92831..f6010d156f6a 100644 --- a/docs-translations/ko/api/content-tracing.md +++ b/docs-translations/ko/api/content-tracing.md @@ -1,30 +1,35 @@ -# content-tracing +# contentTracing -`content-trace` ëª¨ë“ˆì€ Chromium 컨í…츠 모듈단ì—ì„œ ìƒì„±ëœ ë°ì´í„°ë¥¼ 수집하고 추ì í•˜ëŠ”ë° ì‚¬ìš©ë©ë‹ˆë‹¤. +`content-tracing` ëª¨ë“ˆì€ Chromium 컨í…츠 모듈단ì—ì„œ ìƒì„±ëœ ë°ì´í„°ë¥¼ 수집하고 추ì í•˜ëŠ”ë° ì‚¬ìš©ë©ë‹ˆë‹¤. ì´ ëª¨ë“ˆì€ ì›¹ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ í¬í•¨í•˜ê³  있지 않으며 í¬ë¡¬ 브ë¼ìš°ì €ì—ì„œ `chrome://tracing/` 페ì´ì§€ë¥¼ ì—´ì–´ ìƒì„±ëœ 파ì¼ì„ 로드하면 결과를 ë³¼ 수 있습니다. ```javascript -var tracing = require('content-tracing'); -tracing.startRecording('*', tracing.DEFAULT_OPTIONS, function() { +var contentTracing = require('content-tracing'); + +contentTracing.startRecording('*', contentTracing.DEFAULT_OPTIONS, function() { console.log('Tracing started'); setTimeout(function() { - tracing.stopRecording('', function(path) { + contentTracing.stopRecording('', function(path) { console.log('Tracing data recorded to ' + path); }); }, 5000); }); -``` +`` -## tracing.getCategories(callback) +## Methods + +`content-tracing` ëª¨ë“ˆì€ ë‹¤ìŒê³¼ ê°™ì€ ë©”ì„œë“œë¥¼ 가지고 있습니다: + +### `contentTracing.getCategories(callback)` * `callback` Function 카테고리 그룹 세트를 가져옵니다. 카테고리 ê·¸ë£¹ì€ ë„ë‹¬ëœ ì½”ë“œ 경로를 변경할 수 있습니다. -모든 child 프로세스가 `getCategories` ìš”ì²­ì„ ë°›ìœ¼ë©´ `callback`ì´ í˜¸ì¶œë˜ë©° ì¸ìžì— 카테고리 ê·¸ë£¹ì˜ ë°°ì—´ì´ ì „ë‹¬ë©ë‹ˆë‹¤. +모든 child 프로세스가 `getCategories` ìš”ì²­ì„ ìŠ¹ì¸í•˜ë©´ `callback`ì´ í•œ 번 호출ë˜ë©° ì¸ìžì— 카테고리 ê·¸ë£¹ì˜ ë°°ì—´ì´ ì „ë‹¬ë©ë‹ˆë‹¤. -## tracing.startRecording(categoryFilter, traceOptions, callback) +### `contentTracing.startRecording(categoryFilter, traceOptions, callback)` * `categoryFilter` String * `traceOptions` String @@ -33,7 +38,7 @@ tracing.startRecording('*', tracing.DEFAULT_OPTIONS, function() { 모든 프로세스ì—ì„œ ë ˆì½”ë”©ì„ ì‹œìž‘í•©ë‹ˆë‹¤. ë ˆì½”ë”©ì€ ì§€ì—­ì ìœ¼ë¡œ 즉시 실행ë©ë‹ˆë‹¤. 그리고 비ë™ê¸°ë¡œ child 프로세스는 곧 EnableRecording ìš”ì²­ì„ ë°›ê²Œ ë©ë‹ˆë‹¤. -모든 child 프로세스가 `startRecording` ìš”ì²­ì„ ë°›ìœ¼ë©´ `callback`ì´ í˜¸ì¶œë©ë‹ˆë‹¤. +모든 child 프로세스가 `startRecording` ìš”ì²­ì„ ìŠ¹ì¸í•˜ë©´ `callback`ì´ í•œ 번 호출ë©ë‹ˆë‹¤. `categoryFilter`는 ì–´ë–¤ 카테고리 ê·¸ë£¹ì´ íŠ¸ë ˆì´ì‹± ë˜ì–´ì•¼ 하는지 í•„í„°ë§í•  수 있습니다. 필터는 `-` ì ‘ë‘사를 통해 특정 카테고리 ê·¸ë£¹ì„ ì œì™¸í•  수 있습니다. @@ -63,7 +68,7 @@ tracing.startRecording('*', tracing.DEFAULT_OPTIONS, function() { `record-until-full`ì´ ê¸°ë³¸ 모드, `enable-sampling`ê³¼ `enable-systrace`ì˜µì…˜ì€ í¬í•¨ë˜ì§€ ì•ŠìŒ -## tracing.stopRecording(resultFilePath, callback) +## `contentTracing.stopRecording(resultFilePath, callback)` * `resultFilePath` String * `callback` Function @@ -75,12 +80,12 @@ Child 프로세스는 ì¼ë°˜ì ìœ¼ë¡œ ì¶”ì  ë°ì´í„°ì™€ í¬ê·€í•œ 플러시 우리는 추ì ì— ì˜í•œ 런타임 오버헤드를 í”¼í•˜ê³ ìž í•©ë‹ˆë‹¤. 그래서 추ì ì´ ë나면 모든 child í”„ë¡œì„¸ìŠ¤ì— ë³´ë¥˜ëœ ì¶”ì  ë°ì´í„°ë¥¼ 플러시 í•  것ì¸ì§€ 물어봅니다. -모든 child 프로세스가 `stopRecording` ìš”ì²­ì„ ë°›ìœ¼ë©´ `callback`ì— ì¶”ì  ë°ì´í„°ë¥¼ í¬í•¨í•œ 파ì¼ì„ 전달ë©ë‹ˆë‹¤. +모든 child 프로세스가 `stopRecording` ìš”ì²­ì„ ìŠ¹ì¸í•˜ë©´ `callback`ì— ì¶”ì  ë°ì´í„° 파ì¼ì„ í¬í•¨í•˜ì—¬ í•œ 번 호출ë©ë‹ˆë‹¤. ì¶”ì  ë°ì´í„°ëŠ” `resultFilePath` 해당 경로가 비어있는 ê²½ìš°ì— í•œ í•´ 해당 ê²½ë¡œì— ìž‘ì„±ë˜ê±°ë‚˜ ìž„ì‹œ 파ì¼ì— 작성ë©ë‹ˆë‹¤. 실제 íŒŒì¼ ê²½ë¡œëŠ” nullì´ ì•„ë‹Œ ì´ìƒ `callback`ì„ í†µí•´ 전달ë©ë‹ˆë‹¤. -## tracing.startMonitoring(categoryFilter, traceOptions, callback) +### `contentTracing.startMonitoring(categoryFilter, traceOptions, callback)` * `categoryFilter` String * `traceOptions` String @@ -90,17 +95,17 @@ Child 프로세스는 ì¼ë°˜ì ìœ¼ë¡œ ì¶”ì  ë°ì´í„°ì™€ í¬ê·€í•œ 플러시 모니터ë§ì€ 지역ì ìœ¼ë¡œ 즉시 시작ë©ë‹ˆë‹¤. 그리고 ì´ë‚´ ìžì‹ í”„ë¡œì„¸ìŠ¤ë“¤ì´ `startMonitoring` 비ë™ê¸° ìš”ì²­ì„ ë°›ìŠµë‹ˆë‹¤. -모든 ìžì‹ 프로세스가 `startMonitoring` ìš”ì²­ì„ ë°›ìœ¼ë©´ `callback`ì´ í˜¸ì¶œë©ë‹ˆë‹¤. +모든 ìžì‹ 프로세스가 `startMonitoring` ìš”ì²­ì„ ìŠ¹ì¸í•˜ë©´ `callback`ì´ í•œ 번 호출ë©ë‹ˆë‹¤. -## tracing.stopMonitoring(callback); +### `contentTracing.stopMonitoring(callback)` * `callback` Function 모든 프로세스ì—ì„œ 모니터ë§ì„ 중단합니다. -모든 ìžì‹ 프로세스가 `stopMonitoring` ìš”ì²­ì„ ë°›ìœ¼ë©´ `callback`ì´ í˜¸ì¶œë©ë‹ˆë‹¤. +모든 ìžì‹ 프로세스가 `stopMonitoring` ìš”ì²­ì„ ìŠ¹ì¸í•˜ë©´ `callback`ì´ í•œ 번 호출ë©ë‹ˆë‹¤. -## tracing.captureMonitoringSnapshot(resultFilePath, callback) +### `contentTracing.captureMonitoringSnapshot(resultFilePath, callback)` * `resultFilePath` String * `callback` Function @@ -112,15 +117,15 @@ Child 프로세스는 ì¼ë°˜ì ìœ¼ë¡œ ì¶”ì  ë°ì´í„°ì™€ í¬ê·€í•œ 플러시 그리고 우리는 추ì ì‹œ ë°œìƒí•˜ëŠ” 불필요한 런타임 오버헤드를 í”¼í•˜ê³ ìž í•©ë‹ˆë‹¤. 그래서 추ì ì´ ë나면 반드시 비ë™ê¸°ë¡œ ìžì‹ í”„ë¡œì„¸ìŠ¤ë“¤ì˜ ë³´ë¥˜ëœ ì¶”ì  ë°ì´í„°ë¥¼ 플러시 í•  것ì¸ì§€ 물어봅니다. -모든 ìžì‹ 프로세스가 `captureMonitoringSnapshot` ìš”ì²­ì„ ë°›ìœ¼ë©´ ì¶”ì  ë°ì´í„° 파ì¼ì„ í¬í•¨í•˜ëŠ” `callback`ì´ í˜¸ì¶œë©ë‹ˆë‹¤. +모든 ìžì‹ 프로세스가 `captureMonitoringSnapshot` ìš”ì²­ì„ ìŠ¹ì¸í•˜ë©´ ì¶”ì  ë°ì´í„° 파ì¼ì„ í¬í•¨í•˜ëŠ” `callback`ì´ í•œ 번 호출ë©ë‹ˆë‹¤. -## tracing.getTraceBufferUsage(callback) +### `contentTracing.getTraceBufferUsage(callback)` * `callback` Function -ì¶”ì  ë²„í¼ % ì „ì²´ ìƒíƒœì˜ 프로세스간 최대치를 가져옵니다. TraceBufferUsage ê°’ì´ ê²°ì •ë˜ë©´ `callback`ì´ í˜¸ì¶œë©ë‹ˆë‹¤. +ì¶”ì  ë²„í¼ % ì „ì²´ ìƒíƒœì˜ 프로세스간 최대치를 가져옵니다. TraceBufferUsage ê°’ì´ ê²°ì •ë˜ë©´ `callback`ì´ í•œ 번 호출ë©ë‹ˆë‹¤. -## tracing.setWatchEvent(categoryName, eventName, callback) +### `contentTracing.setWatchEvent(categoryName, eventName, callback)` * `categoryName` String * `eventName` String @@ -128,6 +133,6 @@ Child 프로세스는 ì¼ë°˜ì ìœ¼ë¡œ ì¶”ì  ë°ì´í„°ì™€ í¬ê·€í•œ 플러시 `callback`ì€ ì§€ì •ëœ ì´ë²¤íŠ¸ê°€ ì–´ë–¤ ìž‘ì—…ì„ ë°œìƒì‹œí‚¬ 때마다 호출ë©ë‹ˆë‹¤. -## tracing.cancelWatchEvent() +### `contentTracing.cancelWatchEvent()` -Watch ì´ë²¤íŠ¸ë¥¼ 중단합니다. 만약 추ì ì´ 활성화ë˜ì–´ 있다면 ì´ í•¨ìˆ˜ëŠ” watch ì´ë²¤íŠ¸ 콜백과 raceê°€ ì¼ì–´ë‚  것입니다. +Watch ì´ë²¤íŠ¸ë¥¼ 중단합니다. 만약 추ì ì´ 활성화ë˜ì–´ 있다면 ì´ ë©”ì„œë“œëŠ” watch ì´ë²¤íŠ¸ 콜백과 raceê°€ ì¼ì–´ë‚  것입니다. diff --git a/docs-translations/ko/api/crash-reporter.md b/docs-translations/ko/api/crash-reporter.md index b8c076a7ceae..53b5d3b7924c 100644 --- a/docs-translations/ko/api/crash-reporter.md +++ b/docs-translations/ko/api/crash-reporter.md @@ -1,9 +1,12 @@ -# crash-reporter +# crashReporter -ë‹¤ìŒ ì˜ˆì œëŠ” 윈격 ì„œë²„ì— ì–´í”Œë¦¬ì¼€ì´ì…˜ 오류 정보를 ìžë™ìœ¼ë¡œ 보고하는 예제입니다: +`crash-reporter` ëª¨ë“ˆì€ ì–´í”Œë¦¬ì¼€ì´ì…˜ì˜ í¬ëž˜ì‹œ 정보를 ìžë™ìœ¼ë¡œ ì›ê²© ì„œë²„ì— ì—…ë¡œë“œí•˜ëŠ”ë° ì‚¬ìš©í•©ë‹ˆë‹¤. + +ë‹¤ìŒ ì˜ˆì œëŠ” 윈격 ì„œë²„ì— ì–´í”Œë¦¬ì¼€ì´ì…˜ í¬ëž˜ì‹œ 정보를 ìžë™ìœ¼ë¡œ 보고하는 예제입니다: ```javascript -crashReporter = require('crash-reporter'); +var crashReporter = require('crash-reporter'); + crashReporter.start({ productName: 'YourName', companyName: 'YourCompany', @@ -12,38 +15,42 @@ crashReporter.start({ }); ``` -## crashReporter.start(options) +## Methods -* `options` Object - * `productName` String, 기본값: Electron - * `companyName` String, 기본값: GitHub, Inc - * `submitUrl` String, 기본값: http://54.249.141.255:1127/post - * Crash Reporter는 POST ë°©ì‹ìœ¼ë¡œ 해당 URLì— ì „ì†¡ë©ë‹ˆë‹¤. - * `autoSubmit` Boolean, 기본값: true - * trueë¡œ 지정할 경우 ìœ ì €ì˜ ìŠ¹ì¸ ì—†ì´ ìžë™ìœ¼ë¡œ 오류를 보고합니다. - * `ignoreSystemCrashHandler` Boolean, 기본값: false - * `extra` Object - * 오류보고 ì‹œ ê°™ì´ ë³´ë‚¼ 추가 정보를 지정하는 ê°ì²´ìž…니다. - * 문ìžì—´ë¡œ ëœ ì†ì„±ë§Œ ì •ìƒì ìœ¼ë¡œ 보내집니다. - * 중첩 ê°ì²´ëŠ” 지ì›ë˜ì§€ 않습니다. (Nested objects are not supported) +`crash-reporter` ëª¨ë“ˆì€ ë‹¤ìŒê³¼ ê°™ì€ ë©”ì„œë“œë¥¼ 가지고 있습니다: + +### `crashReporter.start(options)` + +* `options` Object, properties: + +* `productName` String, 기본값: Electron +* `companyName` String, 기본값: GitHub, Inc +* `submitUrl` String, 기본값: http://54.249.141.255:1127/post + * í¬ëž˜ì‹œ 리í¬íŠ¸ëŠ” POST ë°©ì‹ìœ¼ë¡œ ì´ URLë¡œ 전송ë©ë‹ˆë‹¤. +* `autoSubmit` Boolean, 기본값: true + * trueë¡œ 지정할 경우 ìœ ì €ì˜ ìŠ¹ì¸ ì—†ì´ ìžë™ìœ¼ë¡œ 오류를 보고합니다. +* `ignoreSystemCrashHandler` Boolean, 기본값: false +* `extra` Object + * í¬ëž˜ì‹œ 리í¬íŠ¸ ì‹œ ê°™ì´ ë³´ë‚¼ 추가 정보를 지정하는 ê°ì²´ìž…니다. + * 문ìžì—´ë¡œ ëœ ì†ì„±ë§Œ ì •ìƒì ìœ¼ë¡œ 보내집니다. + * 중첩 ê°ì²´ëŠ” 지ì›ë˜ì§€ 않습니다. (Nested objects are not supported) -다른 crashReporter APIë“¤ì„ ì‚¬ìš©í•˜ê¸° ì „ì— ì´ í•¨ìˆ˜ë¥¼ 먼저 호출해야 합니다. - +다른 crashReporter API를 사용하기 ì „ì— ì´ ë©”ì„œë“œë¥¼ 먼저 호출해야 합니다. **알림:** OS Xì—ì„  Windows와 Linuxì˜ `breakpad`와 달리 새로운 `crashpad` í´ë¼ì´ì–¸íŠ¸ë¥¼ 사용합니다. 오류 수집 ê¸°ëŠ¥ì„ í™œì„±í™” 시키려면 오류를 수집하고 ì‹¶ì€ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë‚˜ ëžœë”러 프로세스ì—ì„œ -`crashReporter.start` 함수를 호출하여 `crashpad`를 초기화 해야합니다. +`crashReporter.start` 메서드를 호출하여 `crashpad`를 초기화 해야합니다. -## crashReporter.getLastCrashReport() +### `crashReporter.getLastCrashReport()` -마지막 ì˜¤ë¥˜ë³´ê³ ì˜ ë‚ ì§œì™€ ID를 반환합니다. -ì´ì „ 오류보고가 없거나 Crash Reporterê°€ 시작ë˜ì§€ ì•Šì•˜ì„ ê²½ìš° `null`ì´ ë°˜í™˜ë©ë‹ˆë‹¤. +마지막 í¬ëž˜ì‹œ 리í¬íŠ¸ì˜ 날짜와 ID를 반환합니다. +ì´ì „ í¬ëž˜ì‹œ 리í¬íŠ¸ê°€ 없거나 Crash Reporterê°€ 시작ë˜ì§€ ì•Šì•˜ì„ ê²½ìš° `null`ì´ ë°˜í™˜ë©ë‹ˆë‹¤. -## crashReporter.getUploadedReports() +### `crashReporter.getUploadedReports()` -모든 ì—…ë¡œë“œëœ ì˜¤ë¥˜ë³´ê³ ë¥¼ 반환합니다. ê° ë³´ê³ ëŠ” 날짜와 업로드 ID를 í¬í•¨í•˜ê³  있습니다. +모든 ì—…ë¡œë“œëœ í¬ëž˜ì‹œ 리í¬íŠ¸ë¥¼ 반환합니다. ê° ë³´ê³ ëŠ” 날짜와 업로드 ID를 í¬í•¨í•˜ê³  있습니다. -# crash-reporter 오류보고 í˜•ì‹ +## crash-reporter 업로드 í˜•ì‹ Crash Reporter는 다ìŒê³¼ ê°™ì€ ë°ì´í„°ë¥¼ `submitUrl`ì— `POST` ë°©ì‹ìœ¼ë¡œ 전송합니다: @@ -56,5 +63,5 @@ Crash Reporter는 다ìŒê³¼ ê°™ì€ ë°ì´í„°ë¥¼ `submitUrl`ì— `POST` ë°©ì‹ìœ¼ * `_productName` String - Crash Reporterì˜ `options` ê°ì²´ì—ì„œ ì •ì˜í•œ 제품명. * `prod` String - 기본 ì œí’ˆì˜ ì´ë¦„. ì´ ê²½ìš° Electron으로 표시ë©ë‹ˆë‹¤. * `_companyName` String - Crash Reporterì˜ `options` ê°ì²´ì—ì„œ ì •ì˜í•œ 회사명. -* `upload_file_minidump` File - 오류보고 íŒŒì¼ +* `upload_file_minidump` File - í¬ëž˜ì‹œ 리í¬íŠ¸ íŒŒì¼ * Crash Reporterì˜ `options` ê°ì²´ì—ì„œ ì •ì˜í•œ `extra` ê°ì²´ì˜ ì†ì„±ë“¤. diff --git a/docs-translations/ko/api/dialog.md b/docs-translations/ko/api/dialog.md index 4f151f0b1ebb..0c8bdec74a66 100644 --- a/docs-translations/ko/api/dialog.md +++ b/docs-translations/ko/api/dialog.md @@ -1,34 +1,39 @@ # dialog -`dialog` ëª¨ë“ˆì€ ë„¤ì´í‹°ë¸Œ ì‹œìŠ¤í…œì˜ ëŒ€í™” ìƒìžë¥¼ ì¡°ìž‘í•  ë•Œ 사용할 수 있는 API입니다. -웹 어플리케ì´ì…˜ì—ì„œ ì¼ë°˜ 네ì´í‹°ë¸Œ 어플리케ì´ì…˜ê³¼ ê°™ì€ ì‚¬ìš©ìž ê²½í—˜ì„ ì œê³µí•  수 있습니다. +`dialog` ëª¨ë“ˆì€ íŒŒì¼ ì—´ê¸°, 알림과 ê°™ì€ ë„¤ì´í‹°ë¸Œ ì‹œìŠ¤í…œì˜ ëŒ€í™” ìƒìžë¥¼ ì¡°ìž‘í•  ë•Œ 사용할 수 있는 모듈입니다. +ì´ ëª¨ë“ˆì„ ì‚¬ìš©í•˜ë©´ 웹 어플리케ì´ì…˜ì—ì„œ ì¼ë°˜ 네ì´í‹°ë¸Œ 어플리케ì´ì…˜ê³¼ 비슷한 ì‚¬ìš©ìž ê²½í—˜ì„ ì œê³µí•  수 있습니다. ë‹¤ìŒ ì˜ˆì œëŠ” 파ì¼ê³¼ 디렉터리를 다중으로 ì„ íƒí•˜ëŠ” 대화 ìƒìžë¥¼ 표시하는 예제입니다: ```javascript -var win = ...; // 대화 ìƒìžë¥¼ 사용할 ì°½ ê°ì²´ +var win = ...; // 대화 ìƒìžë¥¼ 사용할 BrowserWindow ê°ì²´ var dialog = require('dialog'); console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]})); ``` -**OS X 주ì˜**: 대화 ìƒìžë¥¼ 시트처럼 보여지게 하려면 `browserWindow` ì¸ìžì— `BrowserWindow` ê°ì²´ì˜ 참조를 제공하면 ë©ë‹ˆë‹¤. +**OS X 알림**: 대화 ìƒìžë¥¼ 시트처럼 보여지게 하려면 `browserWindow` ì¸ìžì— `BrowserWindow` ê°ì²´ì˜ 참조를 제공하면 ë©ë‹ˆë‹¤. -## dialog.showOpenDialog([browserWindow], [options], [callback]) +## Methods -* `browserWindow` BrowserWindow -* `options` Object +`dialog` ëª¨ë“ˆì€ ë‹¤ìŒê³¼ ê°™ì€ ë©”ì„œë“œë¥¼ 가지고 있습니다: + +### `dialog.showOpenDialog([browserWindow][, options][, callback])` + +* `browserWindow` BrowserWindow (optional) +* `options` Object (optional) * `title` String * `defaultPath` String * `filters` Array * `properties` Array - 대화 ìƒìžê°€ 사용할 기능(모드)ì´ ë‹´ê¸´ 배열입니다. 다ìŒì„ í¬í•¨í•  수 있습니다: `openFile`, `openDirectory`, `multiSelections`, `createDirectory` -* `callback` Function +* `callback` Function (optional) 사용할 대화 ìƒìžì˜ ê¸°ëŠ¥ì´ ë‹´ê¸´ 배열입니다. 다ìŒì„ í¬í•¨í•  수 있습니다: `openFile`, `openDirectory`, `multiSelections`, `createDirectory` -ìž‘ì—…ì— ì„±ê³µí•˜ë©´ 유저가 ì„ íƒí•œ 파ì¼ì˜ 경로를 í¬í•¨í•œ ë°°ì—´ì„ ë°˜í™˜í•©ë‹ˆë‹¤. ê·¸ ì™¸ì˜ ê²½ìš°ì—” `undefined`를 반환합니다. +ìž‘ì—…ì— ì„±ê³µí•˜ë©´ 콜백으로 유저가 ì„ íƒí•œ 파ì¼ì˜ 경로를 í¬í•¨í•œ ë°°ì—´ì„ ë°˜í™˜í•©ë‹ˆë‹¤. ê·¸ 외엔 `undefined`를 반환합니다. -`filters`를 지정하면 유저가 ì„ íƒ ê°€ëŠ¥í•œ íŒŒì¼ í˜•ì‹ì„ 지정할 수 있습니다. 예제는 다ìŒê³¼ 같습니다: +`filters`를 지정하면 유저가 ì„ íƒ ê°€ëŠ¥í•œ íŒŒì¼ í˜•ì‹ì„ 지정할 수 있습니다. +유저가 ì„ íƒí•  수 있는 íƒ€ìž…ì— ì œí•œì„ ë‘려면 다ìŒê³¼ ê°™ì´ í•  수 있습니다: ```javascript { @@ -42,32 +47,30 @@ console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', ' ``` `extensions` ë°°ì—´ì€ ë°˜ë“œì‹œ 와ì¼ë“œì¹´ë“œì™€ 마침표를 제외한 íŒŒì¼ í™•ìž¥ìžë¥¼ í¬í•¨ì‹œì¼œì•¼ 합니다. -예를 들어 `'png'`는 가능하지만 `'.png'`와 `'*.png'`는 안ë©ë‹ˆë‹¤. +(예를 들어 `'png'`는 가능하지만 `'.png'`와 `'*.png'`는 안ë©ë‹ˆë‹¤) 모든 파ì¼ì„ 보여주려면 `'*'`와 ê°™ì€ ì™€ì¼ë“œì¹´ë“œë¥¼ 사용하면 ë©ë‹ˆë‹¤. (다른 와ì¼ë“œì¹´ë“œëŠ” 지ì›í•˜ì§€ 않습니다) `callback`ì´ ì „ë‹¬ë˜ë©´ 메소드가 비ë™ê¸°ë¡œ ìž‘ë™ë˜ë©° 결과는 `callback(filenames)`ì„ í†µí•´ 전달ë©ë‹ˆë‹¤. -Windows와 Linuxì—ì„  íŒŒì¼ ì„ íƒ ëª¨ë“œ, 디렉터리 ì„ íƒ ëª¨ë“œë¥¼ ë™ì‹œì— 사용할 수 없습니다. -그래서 ì´ ë‘ í”Œëž«í¼ì—ì„  `properties`를 `['openFile', 'openDirectory']`ë¡œ 설정하면 디렉터리 ì„ íƒ ëŒ€í™” ìƒìžê°€ 표시ë©ë‹ˆë‹¤. +**알림:** Windows와 Linuxì—ì„  íŒŒì¼ ì„ íƒ ëª¨ë“œ, 디렉터리 ì„ íƒ ëª¨ë“œë¥¼ ë™ì‹œì— 사용할 수 없습니다. +ì´ëŸ¬í•œ ì´ìœ ë¡œ `properties`를 `['openFile', 'openDirectory']`ë¡œ 설정하면 디렉터리 ì„ íƒ ëŒ€í™” ìƒìžê°€ 표시ë©ë‹ˆë‹¤. -## dialog.showSaveDialog([browserWindow], [options], [callback]) +### `dialog.showSaveDialog([browserWindow][, options][, callback])` -* `browserWindow` BrowserWindow -* `options` Object +* `browserWindow` BrowserWindow (optional) +* `options` Object (optional) * `title` String * `defaultPath` String * `filters` Array -* `callback` Function +* `callback` Function (optional) -ìž‘ì—…ì— ì„±ê³µí•˜ë©´ - -ìž‘ì—…ì— ì„±ê³µí•˜ë©´ 유저가 ì„ íƒí•œ 파ì¼ì˜ 경로를 í¬í•¨í•œ ë°°ì—´ì„ ë°˜í™˜í•©ë‹ˆë‹¤. ê·¸ ì™¸ì˜ ê²½ìš°ì—” `undefined`를 반환합니다. +ìž‘ì—…ì— ì„±ê³µí•˜ë©´ 콜백으로 유저가 ì„ íƒí•œ 파ì¼ì˜ 경로를 í¬í•¨í•œ ë°°ì—´ì„ ë°˜í™˜í•©ë‹ˆë‹¤. ê·¸ 외엔 `undefined`를 반환합니다. `filters`를 지정하면 유저가 저장 가능한 íŒŒì¼ í˜•ì‹ì„ 지정할 수 있습니다. 사용 ë°©ë²•ì€ `dialog.showOpenDialog`ì˜ `filters` ì†ì„±ê³¼ 같습니다. `callback`ì´ ì „ë‹¬ë˜ë©´ 메소드가 비ë™ê¸°ë¡œ ìž‘ë™ë˜ë©° 결과는 `callback(filename)`ì„ í†µí•´ 전달ë©ë‹ˆë‹¤. -## dialog.showMessageBox([browserWindow], options, [callback]) +### `dialog.showMessageBox([browserWindow][, options][, callback])` * `browserWindow` BrowserWindow * `options` Object @@ -78,26 +81,26 @@ Windows와 Linuxì—ì„  íŒŒì¼ ì„ íƒ ëª¨ë“œ, 디렉터리 ì„ íƒ ëª¨ë“œë¥¼ ë™ * `message` String - 대화 ìƒìžì˜ 본문 내용입니다. * `detail` String - ë©”ì‹œì§€ì˜ ì¶”ê°€ 정보입니다. * `icon` [NativeImage](native-image.md) - * `cancelId` Integer - 유저가 대화 ìƒìžì˜ ë²„íŠ¼ì„ í´ë¦­í•˜ì§€ ì•Šê³  대화 ìƒìžë¥¼ ì·¨ì†Œí–ˆì„ ë•Œ 반환ë˜ëŠ” ë²„íŠ¼ì˜ index입니다. - 기본ì ìœ¼ë¡œ 버튼 리스트가 "cancel" ë˜ëŠ” "no" ë¼ë²¨ì„ 가지고 ìžˆì„ ë•Œ 해당 ë²„íŠ¼ì˜ index를 반환합니다. ë”°ë¡œ ë‘ ë¼ë²¨ì´ 지정ë˜ì§€ ì•Šì€ ê²½ìš° 0ì„ ë°˜í™˜í•©ë‹ˆë‹¤. + * `cancelId` Integer - 유저가 대화 ìƒìžì˜ ë²„íŠ¼ì„ í´ë¦­í•˜ì§€ ì•Šê³  대화 ìƒìžë¥¼ ì·¨ì†Œí–ˆì„ ë•Œ 반환ë˜ëŠ” ë²„íŠ¼ì˜ ì¸ë±ìŠ¤ìž…니다. + 기본ì ìœ¼ë¡œ 버튼 리스트가 "cancel" ë˜ëŠ” "no" ë¼ë²¨ì„ 가지고 ìžˆì„ ë•Œ 해당 ë²„íŠ¼ì˜ ì¸ë±ìŠ¤ë¥¼ 반환합니다. ë”°ë¡œ ë‘ ë¼ë²¨ì´ 지정ë˜ì§€ ì•Šì€ ê²½ìš° 0ì„ ë°˜í™˜í•©ë‹ˆë‹¤. OS X와 Windowsì—ì„  `cancelId` 지정 ì—¬ë¶€ì— ìƒê´€ì—†ì´ "Cancel" ë²„íŠ¼ì´ ì–¸ì œë‚˜ `cancelId`ë¡œ 지정ë©ë‹ˆë‹¤. * `noLink` Boolean - Windows Electronì€ "Cancel"ì´ë‚˜ "Yes"와 ê°™ì€ í”히 사용ë˜ëŠ” ë²„íŠ¼ì„ ì°¾ìœ¼ë ¤ê³  ì‹œë„하고 대화 ìƒìž ë‚´ì—ì„œ 해당 ë²„íŠ¼ì„ ì»¤ë§¨ë“œ ë§í¬ì²˜ëŸ¼ 만듭니다. ì´ ê¸°ëŠ¥ìœ¼ë¡œ ì•±ì„ ì¢€ ë” Modern Windows 앱처럼 만들 수 있습니다. ì´ ê¸°ëŠ¥ì„ ì›í•˜ì§€ 않으면 `noLink`를 trueë¡œ 지정하면 ë©ë‹ˆë‹¤. * `callback` Function -대화 ìƒìžë¥¼ 표시합니다. `browserWindow`를 지정하면 대화 ìƒìžê°€ 완전히 ë‹«íž ë•Œê¹Œì§€ëŠ” ì°½ì„ ì‚¬ìš©í•  수 없습니다. -완료시 유저가 ì„ íƒí•œ ë²„íŠ¼ì˜ index를 반환합니다. +대화 ìƒìžë¥¼ 표시합니다. `browserWindow`를 지정하면 대화 ìƒìžê°€ 완전히 ë‹«íž ë•Œê¹Œì§€ 지정한 ì°½ì„ ì‚¬ìš©í•  수 없습니다. +완료 ì‹œ 유저가 ì„ íƒí•œ ë²„íŠ¼ì˜ ì¸ë±ìŠ¤ë¥¼ 반환합니다. 역주: ë¶€ì •ì„ í‘œí˜„í•˜ëŠ” "아니오", "취소"와 ê°™ì€ í•œê¸€ 단어는 지ì›ë˜ì§€ 않습니다. -만약 OS X ë˜ëŠ” Windowsì—ì„œ "확ì¸", "취소"와 ê°™ì€ ìˆœì„œë¡œ ë²„íŠ¼ì„ ì§€ì •í•˜ê²Œ ë  ë•Œ Alt + f4ë¡œ 해당 대화 ìƒìžë¥¼ ë„게 ë˜ë©´ "확ì¸"ì„ ëˆ„ë¥¸ê±¸ë¡œ íŒë‹¨ë˜ì–´ 버립니다. +만약 OS X ë˜ëŠ” Windowsì—ì„œ "확ì¸", "취소"와 ê°™ì€ ìˆœì„œë¡œ ë²„íŠ¼ì„ ì§€ì •í•˜ê²Œ ë  ë•Œ Alt + f4ë¡œ 해당 대화 ìƒìžë¥¼ ë„게 ë˜ë©´ "확ì¸"ì„ ëˆ„ë¥¸ 것으로 íŒë‹¨ë˜ì–´ 버립니다. ì´ë¥¼ 해결하려면 "Cancel"ì„ ëŒ€ì‹  사용하거나 BrowserWindow API를 사용하여 대화 ìƒìžë¥¼ ì§ì ‘ 구현해야합니다. `callback`ì´ ì „ë‹¬ë˜ë©´ 메소드가 비ë™ê¸°ë¡œ ìž‘ë™ë˜ë©° 결과는 `callback(response)`ì„ í†µí•´ 전달ë©ë‹ˆë‹¤. -## dialog.showErrorBox(title, content) +### `dialog.showErrorBox(title, content)` -ì—러 메시지를 보여주는 모달 대화 ìƒìžë¥¼ 표시합니다. +ì—러 메시지를 보여주는 대화 ìƒìžë¥¼ 표시합니다. ì´ API는 `app` ëª¨ë“ˆì˜ `ready` ì´ë²¤íŠ¸ê°€ ë°œìƒí•˜ê¸° ì „ì— ì‚¬ìš©í•  수 있습니다. ì´ ë©”ì†Œë“œëŠ” 보통 어플리케ì´ì…˜ì´ 시작ë˜ê¸° ì „ì— íŠ¹ì •í•œ ì—러를 표시하기 위해 사용ë©ë‹ˆë‹¤. diff --git a/docs-translations/ko/api/file-object.md b/docs-translations/ko/api/file-object.md index 470d5a871ccf..6006220647dd 100644 --- a/docs-translations/ko/api/file-object.md +++ b/docs-translations/ko/api/file-object.md @@ -1,9 +1,10 @@ # `File` ê°ì²´ -DOMì˜ File ì¸í„°íŽ˜ì´ìŠ¤ëŠ” 네ì´í‹°ë¸Œ 파ì¼ì„ 추ìƒí™” 합니다. 유저가 ì§ì ‘ì ìœ¼ë¡œ HTML5 File API를 사용하여 ìž‘ì—…í•  ë•Œ 파ì¼ì˜ 경로를 -ì•Œ 수 있ë„ë¡ Electronì€ íŒŒì¼ì‹œìŠ¤í…œì˜ 실제 íŒŒì¼ ê²½ë¡œë¥¼ ë‹´ì€ `path` ì†ì„±ì„ File ì¸í„°íŽ˜ì´ìŠ¤ì— 추가하였습니다. +DOMì˜ File ì¸í„°íŽ˜ì´ìŠ¤ëŠ” 네ì´í‹°ë¸Œ 파ì¼ì„ 추ìƒí™” 합니다. +유저가 ì§ì ‘ HTML5 File API를 ì´ìš©í•˜ì—¬ ìž‘ì—…í•  ë•Œ ì„ íƒëœ 파ì¼ì˜ 경로를 ì•Œ 수 있ë„ë¡ +Electronì€ íŒŒì¼ì˜ 실제 경로를 ë‹´ì€ `path` ì†ì„±ì„ File ì¸í„°íŽ˜ì´ìŠ¤ì— 추가하였습니다. -ë‹¤ìŒ ì˜ˆì œëŠ” drag n dropí•œ 파ì¼ì˜ 실제 경로를 가져옵니다: +ë‹¤ìŒ ì˜ˆì œëŠ” 앱으로 드래그 앤 드롭한 파ì¼ì˜ 실제 경로를 가져옵니다: ```html
diff --git a/docs-translations/ko/api/frameless-window.md b/docs-translations/ko/api/frameless-window.md index 3dc45b824fd1..a398087e37b4 100644 --- a/docs-translations/ko/api/frameless-window.md +++ b/docs-translations/ko/api/frameless-window.md @@ -1,10 +1,12 @@ -# Frameless 윈ë„ìš° +# Frameless Window -Frameless 윈ë„우는 í…Œë‘리가 없는 윈ë„ìš° ì°½ì„ ë§í•©ë‹ˆë‹¤. +Frameless Window는 [í…Œë‘리](https://developer.mozilla.org/en-US/docs/Glossary/Chrome)ê°€ 없는 창입니다. +ì´ ê¸°ëŠ¥ì€ ìœˆë„ìš° ì°½ì˜ ì¼ë¶€ë¶„ì¸ íˆ´ë°”ì™€ ê°™ì´ ì›¹ 페ì´ì§€ì˜ ì¼ë¶€ë¶„ì´ ì•„ë‹Œ ë¶€ë¶„ì„ ë³´ì´ì§€ ì•Šë„ë¡ í•©ë‹ˆë‹¤. +[`BrowserWindow`](browser-window.md) í´ëž˜ìŠ¤ì˜ 옵션ì—ì„œ 설정할 수 있습니다. -## Frameless 윈ë„ìš° 만들기 +## Frameless Window 만들기 -Frameless 윈ë„우를 만드려면 [BrowserWindow](browser-window.md) ê°ì²´ì˜ `options`ì—ì„œ `frame` ì˜µì…˜ì„ `false`ë¡œ 지정하기만 하면ë©ë‹ˆë‹¤: +Frameless Window를 만드려면 [BrowserWindow](browser-window.md) ê°ì²´ì˜ `options`ì—ì„œ `frame` ì˜µì…˜ì„ `false`ë¡œ 지정하면 ë©ë‹ˆë‹¤: ```javascript var BrowserWindow = require('browser-window'); @@ -13,7 +15,7 @@ var win = new BrowserWindow({ width: 800, height: 600, frame: false }); ## 투명한 ì°½ 만들기 -Frameless 윈ë„ìš°ì˜ ì°½ì˜ ë°°ê²½ì„ íˆ¬ëª…í•˜ê²Œ 만들고 싶다면 `transparent` ì˜µì…˜ì„ `true`ë¡œ 바꿔주기만 하면ë©ë‹ˆë‹¤: +Frameless Windowì˜ ì°½ì˜ ë°°ê²½ì„ íˆ¬ëª…í•˜ê²Œ 만들고 싶다면 `transparent` ì˜µì…˜ì„ `true`ë¡œ 바꿔주기만 하면ë©ë‹ˆë‹¤: ```javascript var win = new BrowserWindow({ transparent: true, frame: false }); @@ -21,22 +23,20 @@ var win = new BrowserWindow({ transparent: true, frame: false }); ### APIì˜ í•œê³„ - - -* 투명한 ì˜ì—­ì„ 통과하여 í´ë¦­í•  수 없습니다. 우리는 ì´ ë¬¸ì œë¥¼ 해결하기 위해 API를 제공할 예정ì´ì§€ë§Œ 현재로ì¨ëŠ” +* 투명한 ì˜ì—­ì„ 통과하여 í´ë¦­í•  수 없습니다. 우리는 ì´ ë¬¸ì œë¥¼ 해결하기 위해 API를 제공할 예정ì´ì—ˆì§€ë§Œ 현재로ì¨ëŠ” [upstream 버그](https://code.google.com/p/chromium/issues/detail?id=387234)ë¡œ ì¸í•´ ì¤‘ë‹¨ëœ ìƒíƒœìž…니다. -* 투명한 ì°½ì€ í¬ê¸°ë¥¼ 조절할 수 없습니다. `resizable` ì†ì„±ì„ `true`ë¡œ í•  경우 몇몇 플랫í¼ì—ì„  윈ë„ìš° í¬ëž˜ì‹œê°€ ì¼ì–´ë‚©ë‹ˆë‹¤. -* `blur` 필터는 웹 페ì´ì§€ì—서만 ì ìš©ë©ë‹ˆë‹¤. 윈ë„ìš° 아래 컨í…츠ì—는 블러 효과를 ì ìš©í•  ë°©ë²•ì´ ì—†ìŠµë‹ˆë‹¤. -* Windowsì—ì„  DWM(ë°ìŠ¤í¬í†± ì°½ 관리ìž)ê°€ 비활성화ë˜ì–´ ìžˆì„ ê²½ìš° ìž‘ë™í•˜ì§€ 않습니다. -* Linux를 사용할 경우 [alpha channel doesn't work on some NVidia drivers](https://code.google.com/p/chromium/issues/detail?id=369209) - upstream 버그가 있으므로 CLI ì˜µì…˜ì— `--enable-transparent-visuals --disable-gpu`ì„ ì¶”ê°€í•´ì•¼ 합니다. +* 투명한 ì°½ì€ í¬ê¸°ë¥¼ 조절할 수 없습니다. `resizable` ì†ì„±ì„ `true`ë¡œ í•  경우 몇몇 플랫í¼ì—ì„  í¬ëž˜ì‹œê°€ ì¼ì–´ë‚©ë‹ˆë‹¤. +* `blur` 필터는 웹 페ì´ì§€ì—서만 ì ìš©ë©ë‹ˆë‹¤. 윈ë„ìš° 아래 컨í…츠ì—는 블러 효과를 ì ìš©í•  ë°©ë²•ì´ ì—†ìŠµë‹ˆë‹¤. (예시: ìœ ì €ì˜ ì‹œìŠ¤í…œì— ì—´ë¦° 다른 어플리케ì´ì…˜) +* Windowsì—ì„  DWM(ë°ìŠ¤í¬í†± ì°½ 관리ìž)ê°€ 비활성화ë˜ì–´ ìžˆì„ ê²½ìš° 투명한 ì°½ì´ ìž‘ë™í•˜ì§€ 않습니다. +* Linux를 사용할 경우 [alpha channel doesn't work on some NVidia drivers](https://code.google.com/p/chromium/issues/detail?id=369209) + upstream 버그가 있는 관계로 투명한 ì°½ ê¸°ëŠ¥ì„ ì‚¬ìš©í•˜ë ¤ë©´ CLI ì˜µì…˜ì— `--enable-transparent-visuals --disable-gpu`ì„ ì¶”ê°€í•´ì•¼ 합니다. ì´ ì˜µì…˜ì€ GPUì˜ ì‚¬ìš©ì„ ì¤‘ë‹¨í•˜ê³  윈ë„우를 ìƒì„±í•˜ëŠ”ë° ARGB를 사용할 수 있ë„ë¡ í•´ì¤ë‹ˆë‹¤. -* OS X(Mac)ì—ì„  네ì´í‹°ë¸Œ 윈ë„ìš°ì˜ ê·¸ë¦¼ìžê°€ 투명한 ì°½ì—ì„  ë³´ì´ì§€ 않습니다. +* OS X(Mac)ì—ì„  네ì´í‹°ë¸Œ ì°½ì—ì„œ 보여지는 그림ìžê°€ 투명한 ì°½ì—ì„  ë³´ì´ì§€ 않습니다. ## 드래그 가능 위치 지정 -기본ì ìœ¼ë¡œ Frameless 윈ë„우는 드래그 í•  수 없습니다. -어플리케ì´ì…˜ì˜ CSSì—ì„œ 특정 범위를 `-webkit-app-region: drag`ë¡œ 지정하면 OSì˜ ê¸°ë³¸ 타ì´í‹€ë°” 처럼 드래그 ë˜ë„ë¡ í•  수 있습니다. +기본ì ìœ¼ë¡œ Frameless Window는 드래그 í•  수 없습니다. +어플리케ì´ì…˜ì˜ CSSì—ì„œ 특정 범위를 `-webkit-app-region: drag`ë¡œ 지정하면 OSì˜ ê¸°ë³¸ 타ì´í‹€ ë°” 처럼 드래그 ë˜ë„ë¡ í•  수 있습니다. 그리고 `-webkit-app-region: no-drag`를 지정해서 드래그 불가능 ì˜ì—­ì„ 만들 ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. 현재 사ê°í˜• í˜•íƒœì˜ ë²”ìœ„ë§Œ 지ì›í•©ë‹ˆë‹¤. ì°½ 전체를 드래그 가능하게 만드려면 `-webkit-app-region: drag`ì„ `body`ì˜ ìŠ¤íƒ€ì¼ì— 지정하면 ë©ë‹ˆë‹¤: @@ -54,13 +54,13 @@ button { } ``` -ë˜í•œ 커스텀 타ì´í‹€ë°”를 만들어 사용할 ë•Œ 타ì´í‹€ë°” ë‚´ë¶€ì˜ ë²„íŠ¼ë„ ë“œëž˜ê·¸ 불가능 ì˜ì—­ìœ¼ë¡œ 지정해야 합니다. +ë”°ë¡œ 커스텀 타ì´í‹€ 바를 만들어 사용할 때는 타ì´í‹€ ë°” ë‚´ë¶€ì˜ ëª¨ë“  ë²„íŠ¼ì„ ë“œëž˜ê·¸ 불가능 ì˜ì—­ìœ¼ë¡œ 지정해야 합니다. ## í…스트 ì„ íƒ -한가지, Frameless 윈ë„ìš°ì—ì„œ í…스트가 ì„ íƒë˜ëŠ” 드래그 ë™ìž‘ì€ í˜¼ëž€ì„ ì•¼ê¸°í•  수 있습니다. -예를 들어 타ì´í‹€ë°”를 드래그 í•  ë•Œ 타ì´í‹€ë°”ì˜ í…스트를 실수로 ì„ íƒí•  수 있습니다. -ì´ë¥¼ 방지하기 위해선 다ìŒê³¼ ê°™ì´ ë“œëž˜ê·¸ ì˜ì—­ì˜ í…스트 ì„ íƒ ë™ìž‘ì„ ë¹„í™œì„±í™”í•´ì•¼ í•  필요가 있습니다: +Frameless Windowì—ì„œ í…스트가 ì„ íƒë˜ëŠ” 드래그 ë™ìž‘ì€ í˜¼ëž€ì„ ì•¼ê¸°í•  수 있습니다. +예를 들어 타ì´í‹€ 바를 드래그 í•  ë•Œ 타ì´í‹€ ë°”ì˜ í…스트를 실수로 ì„ íƒí•  수 있습니다. +ì´ë¥¼ 방지하기 위해 다ìŒê³¼ ê°™ì´ ë“œëž˜ê·¸ ì˜ì—­ì˜ í…스트 ì„ íƒ ê¸°ëŠ¥ì„ ë¹„í™œì„±í™”í•´ì•¼ í•  필요가 있습니다: ```css .titlebar { @@ -71,5 +71,5 @@ button { ## 컨í…스트 메뉴 -몇몇 플랫í¼ì—ì„  드래그 가능 ì˜ì—­ì´ non-client 프레임으로 처리ë©ë‹ˆë‹¤. 그래서 ì´ ì˜ì—­ì—ì„œ 오른쪽 í´ë¦­ì„ í•  경우 시스템 메뉴가 íŒì—… ë©ë‹ˆë‹¤. -그래서 컨í…스트 메뉴 ì§€ì •ì´ ëª¨ë“  플랫í¼ì—ì„œ ì •ìƒì ìœ¼ë¡œ ìž‘ë™í•˜ê²Œ 하려면 커스텀 컨í…스트 메뉴를 드래그 ì˜ì—­ ë‚´ì— ë§Œë“¤ì–´ì„  안ë©ë‹ˆë‹¤. +몇몇 플랫í¼ì—ì„  드래그 가능 ì˜ì—­ì´ non-client 프레임으로 처리ë©ë‹ˆë‹¤. ì´ëŸ¬í•œ 플랫í¼ì—ì„  드래그 가능 ì˜ì—­ì—ì„œ 오른쪽 í´ë¦­ í•  경우 시스템 메뉴가 íŒì—… ë©ë‹ˆë‹¤. +ì´ëŸ¬í•œ ì´ìœ ë¡œ 컨í…스트 메뉴 지정 ì‹œ 모든 플랫í¼ì—ì„œ ì •ìƒì ìœ¼ë¡œ ìž‘ë™í•˜ê²Œ 하려면 커스텀 컨í…스트 메뉴를 드래그 ì˜ì—­ ë‚´ì— ë§Œë“¤ì–´ì„  안ë©ë‹ˆë‹¤. diff --git a/docs-translations/ko/api/menu-item.md b/docs-translations/ko/api/menu-item.md index 519b7fb237a3..4d79fb1d44fa 100644 --- a/docs-translations/ko/api/menu-item.md +++ b/docs-translations/ko/api/menu-item.md @@ -5,7 +5,7 @@ ### new MenuItem(options) * `options` Object - * `click` Function - 메뉴 ì•„ì´í…œì´ í´ë¦­ë  ë•Œ 호출ë˜ëŠ” 콜백함수 + * `click` Function - 메뉴 ì•„ì´í…œì´ í´ë¦­ë  ë•Œ 호출ë˜ëŠ” 콜백 함수 * `selector` String - First Responderê°€ í´ë¦­ë  ë•Œ 호출 ë˜ëŠ” ì„ íƒìž (OS X ì „ìš©) * `type` String - `MenuItem`ì˜ íƒ€ìž… `normal`, `separator`, `submenu`, `checkbox` ë˜ëŠ” `radio` 사용가능 * `label` String diff --git a/docs-translations/ko/api/menu.md b/docs-translations/ko/api/menu.md index 3303a55d05f2..62e26f13685b 100644 --- a/docs-translations/ko/api/menu.md +++ b/docs-translations/ko/api/menu.md @@ -181,9 +181,9 @@ Menu.setApplicationMenu(menu); * `action` String `action`ì„ ì–´í”Œë¦¬ì¼€ì´ì…˜ì˜ first responderì— ì „ë‹¬í•©ë‹ˆë‹¤. -ì´ í•¨ìˆ˜ëŠ” Cocoa 메뉴 ë™ìž‘ì„ ì—뮬레ì´íŠ¸ í•˜ëŠ”ë° ì‚¬ìš©ë˜ë©° 보통 `MenuItem`ì˜ `selector` ì†ì„±ì— 사용ë©ë‹ˆë‹¤. +ì´ ë©”ì„œë“œëŠ” Cocoa 메뉴 ë™ìž‘ì„ ì—뮬레ì´íŠ¸ í•˜ëŠ”ë° ì‚¬ìš©ë˜ë©° 보통 `MenuItem`ì˜ `selector` ì†ì„±ì— 사용ë©ë‹ˆë‹¤. -**알림:** ì´ í•¨ìˆ˜ëŠ” OS Xì—서만 사용할 수 있습니다. +**알림:** ì´ ë©”ì„œë“œëŠ” OS Xì—서만 사용할 수 있습니다. ### Class Method: Menu.buildFromTemplate(template) diff --git a/docs-translations/ko/api/remote.md b/docs-translations/ko/api/remote.md index c2713db4a910..8700ba21c57f 100644 --- a/docs-translations/ko/api/remote.md +++ b/docs-translations/ko/api/remote.md @@ -20,8 +20,8 @@ win.loadUrl('https://github.com'); ## Remote ê°ì²´ -`remote` 모듈로부터 ë°˜í™˜ëœ ê° ê°ì²´(함수 í¬í•¨)는 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì˜ ê°ì²´ë¥¼ 추ìƒí™” í•œ ê°ì²´ìž…니다. (우리는 ê·¸ê²ƒì„ remote ê°ì²´ ë˜ëŠ” remote 함수ë¼ê³  부릅니다) -Remote ëª¨ë“ˆì˜ í•¨ìˆ˜ë¥¼ 호출하거나, ê°ì²´ì— 접근하거나, ìƒì„±ìžë¡œ ê°ì²´ë¥¼ ìƒì„±í•˜ëŠ” ë“±ì˜ ìž‘ì—…ì€ ì‹¤ì§ˆì ìœ¼ë¡œ ë™ê¸°í˜• inter-process 메시지를 보냅니다. +`remote` 모듈로부터 ë°˜í™˜ëœ ê° ê°ì²´(메서드 í¬í•¨)는 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì˜ ê°ì²´ë¥¼ 추ìƒí™” í•œ ê°ì²´ìž…니다. (우리는 ê·¸ê²ƒì„ remote ê°ì²´ ë˜ëŠ” remote 함수ë¼ê³  부릅니다) +Remote ëª¨ë“ˆì˜ ë©”ì„œë“œë¥¼ 호출하거나, ê°ì²´ì— 접근하거나, ìƒì„±ìžë¡œ ê°ì²´ë¥¼ ìƒì„±í•˜ëŠ” ë“±ì˜ ìž‘ì—…ì€ ì‹¤ì§ˆì ìœ¼ë¡œ ë™ê¸°í˜• inter-process 메시지를 보냅니다. ìœ„ì˜ ì˜ˆì œì—ì„œ 사용한 ë‘ `BrowserWindow`와 `win`ì€ remote ê°ì²´ìž…니다. 그리고 `new BrowserWindow`ì´ ìƒì„±í•˜ëŠ” `BrowserWindow` ê°ì²´ëŠ” ëžœë”러 프로세스ì—ì„œ ìƒì„±ë˜ì§€ 않습니다. ëŒ€ì‹ ì— ì´ `BrowserWindow` ê°ì²´ëŠ” ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ ìƒì„±ë˜ë©° ëžœë”러 í”„ë¡œì„¸ìŠ¤ì— `win` ê°ì²´ì™€ ê°™ì´ ì´ì— 대ì‘하는 remote ê°ì²´ë¥¼ 반환합니다. @@ -38,16 +38,45 @@ Remote ê°ì²´ê°€ GC ë˜ë ¤ë©´ 대ì‘하는 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ 내부 ê°ì²´ì˜ ## ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 콜백 넘기기 -몇몇 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì˜ API는 콜백 함수를 사용합니다. 그리고 보통 remote 함수를 호출할 ë•Œ 콜백 함수를 넘길 것입니다. -`remote` ëª¨ë“ˆì€ ì´ë¥¼ 지ì›í•©ë‹ˆë‹¤. 하지만 반드시 주ì˜í•´ì„œ 사용해야 합니다. +ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì˜ ì½”ë“œëŠ” `remote` ëª¨ë“ˆì„ í†µí•´ ëžœë”러 프로세스가 전달하는 콜백 함수를 ë°›ì„ ìˆ˜ 있습니다. +하지만 ì´ ìž‘ì—…ì€ ë°˜ë“œì‹œ 주ì˜ë¥¼ 기울여 사용해야 합니다. 첫째, ë°ë“œë½ì„ 피하기 위해 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ ì „ë‹¬ëœ ì½œë°±ë“¤ì€ ë¹„ë™ê¸°ë¡œ 호출ë©ë‹ˆë‹¤. -그래서 ì „ë‹¬ëœ ì½œë°±ë“¤ì´ ì–¸ì œë‚˜ ê°’ì„ ë°˜í™˜í•  것ì´ë¼ê³  기대하면 안 ë©ë‹ˆë‹¤. +ì´ëŸ¬í•œ ì´ìœ ë¡œ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ ì „ë‹¬ëœ ì½œë°±ë“¤ì˜ ë°˜í™˜ ê°’ì„ ë‚´ë¶€ 함수ì—ì„œ 언제나 ì •ìƒì ìœ¼ë¡œ ë°›ì„ ê²ƒì´ë¼ê³  예측해선 안ë©ë‹ˆë‹¤. -둘째, ì½œë°±ë“¤ì€ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 전송ë˜ê³  í˜¸ì¶œëœ í›„ì—ë„ ìžë™ìœ¼ë¡œ 참조가 릴리즈 ë˜ì§€ 않습니다. -참조는 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ GCê°€ ì¼ì–´ë‚˜ê¸° 전까지 ê³„ì† ë‚¨ì•„ìžˆê²Œ ë©ë‹ˆë‹¤. +예를 들어 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ `Array.map` ê°™ì€ ë©”ì„œë“œë¥¼ 사용할 ë•Œ ëžœë”러 프로세스ì—ì„œ ì „ë‹¬ëœ í•¨ìˆ˜ë¥¼ 사용해선 안ë©ë‹ˆë‹¤: -ë‹¤ìŒ ì½”ë“œë¥¼ ë³´ë©´ ëŠë‚Œì´ 팟 하고 올 것입니다. ì´ ì˜ˆì œëŠ” remote ê°ì²´ì— `close` ì´ë²¤íŠ¸ ì½œë°±ì„ ì„¤ì¹˜í•©ë‹ˆë‹¤: +```javascript +// mapNumbers.js ë©”ì¸ í”„ë¡œì„¸ìŠ¤ +exports.withRendererCallback = function(mapper) { + return [1,2,3].map(mapper); +} + +exports.withLocalCallback = function() { + return exports.mapNumbers(function(x) { + return x + 1; + }); +} + +// ëžœë”러 프로세스 +var mapNumbers = require("remote").require("mapNumbers"); + +var withRendererCb = mapNumbers.withRendererCallback(function(x) { + return x + 1; +}) + +var withLocalCb = mapNumbers.withLocalCallback() + +console.log(withRendererCb, withLocalCb) // [true, true, true], [2, 3, 4] +``` + +보다시피 ëžœë”러 ì½œë°±ì˜ ë™ê¸° 반환 ê°’ì€ ì˜ˆìƒë˜ì§€ ì•Šì€ ì²˜ë¦¬ìž…ë‹ˆë‹¤. +그리고 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ 처리한 í•¨ìˆ˜ì˜ ë°˜í™˜ ê°’ê³¼ ì¼ì¹˜í•˜ì§€ 않습니다. + +둘째, ì½œë°±ë“¤ì€ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 전달, í˜¸ì¶œëœ ì´í›„ì—ë„ ìžë™ìœ¼ë¡œ í•¨ìˆ˜ì˜ ì°¸ì¡°ê°€ 릴리즈 ë˜ì§€ 않습니다. +함수 참조는 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ GCê°€ ì¼ì–´ë‚˜ê¸° 전까지 ê³„ì† í”„ë¡œì„¸ìŠ¤ì— ë‚¨ì•„ìžˆê²Œ ë©ë‹ˆë‹¤. + +ë‹¤ìŒ ì½”ë“œë¥¼ ë³´ë©´ ëŠë‚Œì´ 올 것입니다. ì´ ì˜ˆì œëŠ” remote ê°ì²´ì— `close` ì´ë²¤íŠ¸ ì½œë°±ì„ ì„¤ì¹˜í•©ë‹ˆë‹¤: ```javascript var remote = require('remote'); @@ -56,11 +85,14 @@ remote.getCurrentWindow().on('close', function() { }); ``` -문제는 ì´ ì´ë²¤íŠ¸ëŠ” 명시ì ìœ¼ë¡œ 제거하지 않는 ì´ìƒ 계ì†í•´ì„œ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì— ë‚¨ì•„ìžˆê²Œ ëœë‹¤ëŠ” 것입니다. -그래서 매 ì°½ì„ ìƒˆë¡œê³ ì¹¨ í•  때마다 ì½œë°±ì´ ìƒˆë¡­ê²Œ 설치ë˜ë©° ì´ì „ ì½œë°±ì€ ë–¨ê¶ˆì ¸ 누수가 ë©ë‹ˆë‹¤. -설ìƒê°€ìƒìœ¼ë¡œ ì´ì „ì— ì„¤ì¹˜í•œ ì½œë°±ì˜ ì½˜í…스트가 릴리즈 ë˜ê³  나서 `close` ì´ë²¤íŠ¸ê°€ ë°œìƒí•˜ë©´ 예외가 ë°œìƒí•˜ê³  ë©”ì¸ í”„ë¡œì„¸ìŠ¤ê°€ ìž‘ë™ ì¤‘ì§€ë©ë‹ˆë‹¤. +하지만 ì´ ì½”ë“œ 처럼 ì´ë²¤íŠ¸ë¥¼ 명시ì ìœ¼ë¡œ 제거하지 않는 ì´ìƒ 콜백 í•¨ìˆ˜ì˜ ì°¸ì¡°ê°€ 계ì†í•´ì„œ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì— ë‚¨ì•„ìžˆê²Œ ë©ë‹ˆë‹¤. +만약 명시ì ìœ¼ë¡œ ì½œë°±ì„ ì œê±°í•˜ì§€ 않으면 매 번 ì°½ì„ ìƒˆë¡œê³ ì¹¨ í•  때마다 ì½œë°±ì„ ìƒˆë¡œ 설치합니다. +게다가 ì´ì „ ì½œë°±ì´ ì œê±°ë˜ì§€ ì•Šê³  계ì†í•´ì„œ 쌓ì´ë©´ì„œ 메모리 누수가 ë°œìƒí•©ë‹ˆë‹¤. -ì¼ë°˜ì ìœ¼ë¡œ 정확히 ë¬´ì—‡ì„ í•  것ì¸ì§€ 잘 알고 있지 않는 ì´ìƒ 웬만하면 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 콜백 함수를 넘기는 ê±´ ìžì œí•˜ëŠ” 게 좋습니다. +설ìƒê°€ìƒìœ¼ë¡œ ì´ì „ì— ì„¤ì¹˜ëœ ì½œë°±ì˜ ì½˜í…스트가 릴리즈 ë˜ê³  ë‚œ 후(예: 페ì´ì§€ 새로고침) `close` ì´ë²¤íŠ¸ê°€ ë°œìƒí•˜ë©´ 예외가 ë°œìƒí•˜ê³  ë©”ì¸ í”„ë¡œì„¸ìŠ¤ê°€ ìž‘ë™ ì¤‘ì§€ë©ë‹ˆë‹¤. + +ì´ëŸ¬í•œ 문제를 피하려면 ëžœë”러 프로세스ì—ì„œ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 넘긴 í•¨ìˆ˜ì˜ ì°¸ì¡°ë¥¼ 사용 후 확실하게 제거해야 합니다. +ìž‘ì—… 후 ì´ë²¤íŠ¸ ì½œë°±ì„ í¬í•¨í•˜ì—¬ ì±…ìž„ 있게 í•¨ìˆ˜ì˜ ì°¸ì¡°ë¥¼ 제거하거나 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ ëžœë”러 프로세스가 ì¢…ë£Œë  ë•Œ 내부ì ìœ¼ë¡œ 함수 참조를 제거하ë„ë¡ ì„¤ê³„í•´ì•¼ 합니다. ## remote.require(module) diff --git a/docs-translations/ko/api/web-frame.md b/docs-translations/ko/api/web-frame.md index 4edbd4d6ec64..9829520901d2 100644 --- a/docs-translations/ko/api/web-frame.md +++ b/docs-translations/ko/api/web-frame.md @@ -1,8 +1,8 @@ # web-frame -`web-frame` ëª¨ë“ˆì€ í˜„ìž¬ 웹 페ì´ì§€ì˜ ëžœë”ë§ ìƒíƒœë¥¼ 설정 í•  수 있ë„ë¡ í•´ì¤ë‹ˆë‹¤. +`web-frame` ëª¨ë“ˆì€ í˜„ìž¬ 웹 페ì´ì§€ì˜ ëžœë”ë§ ìƒíƒœë¥¼ 설정 í•  수 있ë„ë¡ ê´€ë ¨ 유틸리티를 제공하는 모듈입니다. -ë‹¤ìŒ ì˜ˆì œëŠ” 현재 페ì´ì§€ë¥¼ 200% 줌 합니다. +ë‹¤ìŒ ì˜ˆì œëŠ” 현재 페ì´ì§€ë¥¼ 200% 줌 합니다: ```javascript var webFrame = require('web-frame'); @@ -30,6 +30,13 @@ webFrame.setZoomFactor(2); 현재 줌 ë ˆë²¨ì„ ë°˜í™˜í•©ë‹ˆë‹¤. +## webFrame.setZoomLevelLimits(minimumLevel, maximumLevel) + +* `minimumLevel` Number +* `maximumLevel` Number + +줌 ë ˆë²¨ì˜ ìµœëŒ€, 최소치를 지정합니다. + ## webFrame.setSpellCheckProvider(language, autoCorrectWord, provider) * `language` String diff --git a/docs-translations/ko/api/window-open.md b/docs-translations/ko/api/window-open.md index a93bfda84178..d4e0509e9ec6 100644 --- a/docs-translations/ko/api/window-open.md +++ b/docs-translations/ko/api/window-open.md @@ -1,6 +1,6 @@ -# `window.open` 함수 +# `window.open` 메서드 -`window.open` 함수가 호출ë˜ë©´ 새 ì°½ì—ì„œ 새로운 페ì´ì§€ë¥¼ 불러옵니다. +`window.open` 메서드가 호출ë˜ë©´ 새 ì°½ì—ì„œ 새로운 페ì´ì§€ë¥¼ 불러옵니다. ì´ ì°½ì€ `url`ë¡œ 부터 만들어진 `BrowserWindow`ì˜ ìƒˆ ì¸ìŠ¤í„´ìŠ¤ì´ë©° 본 ê°ì²´ 대신 페ì´ì§€ì˜ ì»¨íŠ¸ë¡¤ì´ ì œí•œëœ í”„ë¡ì‹œ ê°ì²´ë¥¼ 반환합니다. 프ë¡ì‹œ ê°ì²´ëŠ” ê¸°ì¡´ì˜ ì›¹ 페ì´ì§€ì™€ í˜¸í™˜ë  ìˆ˜ 있ë„ë¡ ì¼ë¶€ ì œí•œëœ í‘œì¤€ 기능만 가지고 있습니다. @@ -54,4 +54,4 @@ Forcefully closes the child window without calling its unload event. ìžì‹ 윈ë„ìš°ì— ë©”ì‹œì§€ë¥¼ 보냅니다. 특정한 originì„ ì§€ì •í•  ìˆ˜ë„ ìžˆìœ¼ë©° `*`를 지정하면 ë”°ë¡œ origin ì„¤ì •ì„ ì‚¬ìš©í•˜ì§€ 않습니다. -참고로 ìžì‹ 윈ë„ìš°ì˜ `window.opener` ê°ì²´ì—는 다른 ì†ì„± ì—†ì´ ì´ í•¨ìˆ˜ 하나만 구현ë˜ì–´ 있습니다. +참고로 ìžì‹ 윈ë„ìš°ì˜ `window.opener` ê°ì²´ì—는 다른 ì†ì„± ì—†ì´ ì´ ë©”ì„œë“œ í•œ 개만 구현ë˜ì–´ 있습니다. diff --git a/docs-translations/ko/development/build-instructions-windows.md b/docs-translations/ko/development/build-instructions-windows.md index 06c2349b3d9b..df829de319d5 100644 --- a/docs-translations/ko/development/build-instructions-windows.md +++ b/docs-translations/ko/development/build-instructions-windows.md @@ -72,6 +72,15 @@ python script\cpplint.py python script\test.py ``` +테스트 실행시 `runas`와 ê°™ì€ ë„¤ì´í‹°ë¸Œ ëª¨ë“ˆì„ í¬í•¨í•˜ëŠ”ë° ì´ ëª¨ë“ˆì€ ë””ë²„ê·¸ 빌드ì—ì„œ ê°™ì´ ì‚¬ìš©í•  수 없습니다. +하지만 여전히 릴리즈 빌드ì—ì„  사용할 수 있습니다. + +릴리즈 빌드로 테스트를 실행하려면 ë‹¤ìŒ ì»¤ë§¨ë“œë¥¼ 사용하면 ë©ë‹ˆë‹¤: + +```powershell +python script\test.py -R +``` + ## 문제 í•´ê²° ### Command xxxx not found diff --git a/docs-translations/ko/development/setting-up-symbol-server.md b/docs-translations/ko/development/setting-up-symbol-server.md index 4d965a04da94..ed43e0fae295 100644 --- a/docs-translations/ko/development/setting-up-symbol-server.md +++ b/docs-translations/ko/development/setting-up-symbol-server.md @@ -1,6 +1,6 @@ # 디버거ì—ì„œ 디버그 심볼 서버 설정 -디버그 ì‹¬ë³¼ì€ ë””ë²„ê¹… ì„¸ì…˜ì„ ë” ì¢‹ê²Œ 개선해 ì¤ë‹ˆë‹¤. 디버그 ì‹¬ë³¼ì€ ì‹¤í–‰ 파ì¼ê³¼ ë™ì  ë§í¬ ë¼ì´ë¸ŒëŸ¬ë¦¬ì—ì„œ í•¨ìˆ˜ì— ëŒ€í•œ 정보를 ë‹´ê³  있으며 명료한 함수 호출 ìŠ¤í… ì •ë³´ë¥¼ 제공합니다. +디버그 ì‹¬ë³¼ì€ ë””ë²„ê¹… ì„¸ì…˜ì„ ë” ì¢‹ê²Œ 개선해 ì¤ë‹ˆë‹¤. 디버그 ì‹¬ë³¼ì€ ì‹¤í–‰ 파ì¼ê³¼ ë™ì  ë§í¬ ë¼ì´ë¸ŒëŸ¬ë¦¬ì—ì„œ ë©”ì„œë“œì— ëŒ€í•œ 정보를 ë‹´ê³  있으며 명료한 함수 호출 ìŠ¤í… ì •ë³´ë¥¼ 제공합니다. 심볼 서버는 유저가 í¬ê¸°ê°€ í° ë””ë²„ê¹…ìš© 파ì¼ì„ 필수ì ìœ¼ë¡œ 다운로드 받지 ì•Šê³ ë„ ë””ë²„ê±°ê°€ ì•Œë§žì€ ì‹¬ë³¼, ë°”ì´ë„ˆë¦¬ 그리고 소스를 ìžë™ì ìœ¼ë¡œ 로드할 수 있ë„ë¡ í•´ì¤ë‹ˆë‹¤. 서버 ì‚¬ìš©ë²•ì€ [Microsoftì˜ ì‹¬ë³¼ 서버](http://support.microsoft.com/kb/311503)와 비슷합니다. ì´ ë¬¸ì„œë¥¼ 참조하세요. diff --git a/docs-translations/ko/styleguide.md b/docs-translations/ko/styleguide.md index e63a016e8780..1916f80c68ef 100644 --- a/docs-translations/ko/styleguide.md +++ b/docs-translations/ko/styleguide.md @@ -27,9 +27,9 @@ Electron 문서를 작성하는 ê·œì¹™ì€ ë‹¤ìŒê³¼ 같습니다. Electron 문서 구조를 ì´í•´í•˜ëŠ” ë° ì°¸ê³ í•  수 있는 유용한 ë„움ë§ìž…니다. -### 메서드 +### Methods -[메서드](https://developer.mozilla.org/en-US/docs/Glossary/Method) ë¬¸ì„œì˜ ì˜ˆì œìž…ë‹ˆë‹¤: +[Method](https://developer.mozilla.org/en-US/docs/Glossary/Method) ë¬¸ì„œì˜ ì˜ˆì œìž…ë‹ˆë‹¤: --- diff --git a/docs-translations/ko/tutorial/application-packaging.md b/docs-translations/ko/tutorial/application-packaging.md index 893ac0e2e59f..4c799d71da4f 100644 --- a/docs-translations/ko/tutorial/application-packaging.md +++ b/docs-translations/ko/tutorial/application-packaging.md @@ -118,7 +118,7 @@ originalFs.readFileSync('/path/to/example.asar'); 몇몇 API는 ì‹œìŠ¤í…œì˜ ì‹¤ì œ 파ì¼ì˜ 경로를 기반으로 ìž‘ë™í•˜ë¯€ë¡œ ì´ APIë“¤ì„ ì‚¬ìš©í•  ë• Electronì€ ì´ APIê°€ ì›í• í•˜ê²Œ ìž‘ë™í•  수 있ë„ë¡ í•˜ê¸° 위해 ìž„ì‹œê²½ë¡œì— í•´ë‹¹ 파ì¼ë“¤ì˜ ì••ì¶•ì„ í•´ì œí•©ë‹ˆë‹¤. ì´ ìž‘ì—…ì€ ì•½ê°„ì˜ ì˜¤ë²„í—¤ë“œë¥¼ 불러 ì¼ìœ¼í‚¬ 수 있습니다. -해당하는 API 함수는 다ìŒê³¼ 같습니다: +해당하는 API 메서드는 다ìŒê³¼ 같습니다: * `child_process.execFile` * `fs.open` diff --git a/docs-translations/ko/tutorial/using-native-node-modules.md b/docs-translations/ko/tutorial/using-native-node-modules.md index 1e67ee25305d..1dd23e5f1dcf 100644 --- a/docs-translations/ko/tutorial/using-native-node-modules.md +++ b/docs-translations/ko/tutorial/using-native-node-modules.md @@ -1,25 +1,23 @@ # 네ì´í‹°ë¸Œ node 모듈 사용하기 -__역주: 현재 Electronì€ node.js대신 io.js를 사용합니다. ë¬¸ì„œì— ê¸°ìž¬ëœ ë²„ì „ê³¼ 다를 수 있습니다__ - -Electronì—ì„  node.js 네ì´í‹°ë¸Œ ëª¨ë“ˆì´ ì§€ì›ë©ë‹ˆë‹¤. 하지만 Electronì€ ê³µì‹ node.jsì˜ V8 엔진과는 달리 다른 V8 ë²„ì „ì„ ì‚¬ìš©í•©ë‹ˆë‹¤. -그런 ì´ìœ ë¡œ 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ì‚¬ìš©í•˜ê¸° 위해선 Electronì˜ V8 ë²„ì „ì— ë§žì¶° 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë‹¤ì‹œ 빌드하고 í—¤ë”를 변경해야 합니다. +Electronì—ì„  node.js 네ì´í‹°ë¸Œ ëª¨ë“ˆì´ ì§€ì›ë©ë‹ˆë‹¤. 하지만 Electronì€ ê³µì‹ node.jsì˜ V8 엔진과는 다른 V8 ë²„ì „ì„ ì‚¬ìš©í•©ë‹ˆë‹¤. +ì´ëŸ¬í•œ ì´ìœ ë¡œ 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ì‚¬ìš©í•˜ê¸° 위해선 Electronì˜ V8 ë²„ì „ì— ë§žì¶° 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë‹¤ì‹œ 빌드하고 í—¤ë”를 변경해야 합니다. ## 네ì´í‹°ë¸Œ node 모듈 호환성 -Node v0.11.x 버전부터는 V8 APIì˜ ì¤‘ëŒ€í•œ ë³€ê²½ì´ ìžˆì—ˆìŠµë‹ˆë‹¤. 하지만 ì¼ë°˜ì ìœ¼ë¡œ 모든 네ì´í‹°ë¸Œ ëª¨ë“ˆì€ Node v0.10.x ë²„ì „ì„ íƒ€ê²Ÿìœ¼ë¡œ 작성 ë˜ì—ˆê¸° ë•Œë¬¸ì— -Node v0.11.x 버전ì—ì„  ìž‘ë™í•˜ì§€ 않습니다. Electronì€ ë‚´ë¶€ì ìœ¼ë¡œ Node v0.11.13 ë²„ì „ì„ ì‚¬ìš©í•©ë‹ˆë‹¤. 그래서 위ì—ì„œ 설명한 문제가 ë°œìƒí•©ë‹ˆë‹¤. +Node v0.11.x 버전부터는 V8 APIì˜ ì¤‘ëŒ€í•œ ë³€ê²½ì´ ìžˆì—ˆìŠµë‹ˆë‹¤. 하지만 ëŒ€ë¶€ë¶„ì˜ ë„¤ì´í‹°ë¸Œ ëª¨ë“ˆì€ Node v0.10.x ë²„ì „ì„ íƒ€ê²Ÿìœ¼ë¡œ 작성 ë˜ì—ˆê¸° ë•Œë¬¸ì— +새로운 Node ë˜ëŠ” io.js 버전ì—ì„œ ìž‘ë™í•˜ì§€ ì•Šì„ ìˆ˜ 있습니다. Electronì€ ë‚´ë¶€ì ìœ¼ë¡œ __io.js v3.1.0__ ë²„ì „ì„ ì‚¬ìš©í•˜ê¸° ë•Œë¬¸ì— ì´ëŸ¬í•œ 호환성 문제가 ë°œìƒí•  수 있습니다. -ì´ ë¬¸ì œë¥¼ 해결하기 위해 ëª¨ë“ˆì´ Node v0.11.x ë²„ì „ì„ ì§€ì›í•  수 있ë„ë¡ í•´ì•¼í•©ë‹ˆë‹¤. -현재 [ë§Žì€ ëª¨ë“ˆë“¤](https://www.npmjs.org/browse/depended/nan)ì´ ì•ˆì •ì ìœ¼ë¡œ ë‘ ë²„ì „ ëª¨ë‘ ì§€ì›í•˜ê³  있지만 ì˜¤ëž˜ëœ ëª¨ë“ˆì˜ ê²½ìš° Node v0.10.x ë²„ì „ë§Œì„ ì§€ì›í•˜ê³  있습니다. -예를 들어 [nan](https://github.com/rvagg/nan) ëª¨ë“ˆì„ ì‚¬ìš©í•´ì•¼ 하는 경우 Node v0.11.x 버전으로 í¬íŒ… í•  필요가 있습니다. +ì´ ë¬¸ì œë¥¼ 해결하기 위해선 ëª¨ë“ˆì´ v0.11.x ë˜ëŠ” 최신 ë²„ì „ì„ ì§€ì›í•  수 있ë„ë¡ ë³€ê²½í•´ì•¼ 합니다. +현재 [ë§Žì€ ëª¨ë“ˆë“¤](https://www.npmjs.org/browse/depended/nan)ì´ ì•ˆì •ì ìœ¼ë¡œ ë‘ ë²„ì „ ëª¨ë‘ ì§€ì›í•˜ê³  있지만 ì˜¤ëž˜ëœ ëª¨ë“ˆì˜ ê²½ìš° 여전히 Node v0.10.x ë²„ì „ë§Œì„ ì§€ì›í•˜ê³  있습니다. +예를 들어 [nan](https://github.com/rvagg/nan) ëª¨ë“ˆì„ ì‚¬ìš©í•´ì•¼ 한다면 Node v0.11.x ë˜ëŠ” 최신 ë²„ì „ì˜ Node와 io.jsë¡œ í¬íŒ… í•  필요가 있습니다. ## 네ì´í‹°ë¸Œ 모듈 설치하는 방법 ### 쉬운 방법 - 권장 -[`electron-rebuild`](https://github.com/paulcbetts/electron-rebuild) 패키지를 사용하면 아주 빠르고 정확하게 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë‹¤ì‹œ 빌드할 수 있습니다. -다ìŒì˜ 간단한 절차를 통해 ìžë™ìœ¼ë¡œ í—¤ë”를 다운로드하고 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë¹Œë“œí•  수 있습니다: +[`electron-rebuild`](https://github.com/paulcbetts/electron-rebuild) 패키지를 사용하면 빠르고 간단하게 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë‹¤ì‹œ 빌드할 수 있습니다. +간단한 절차를 통해 ìžë™ìœ¼ë¡œ í—¤ë”를 다운로드하고 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë¹Œë“œí•  수 있습니다: ```sh npm install --save-dev electron-rebuild @@ -30,7 +28,7 @@ npm install --save-dev electron-rebuild ### node-gypì„ ì´ìš©í•œ 방법 -Node ëª¨ë“ˆì„ `node-gyp`를 사용하여 Electronì„ íƒ€ê²Ÿìœ¼ë¡œ 빌드할 ë• `node-gyp`ì— í—¤ë” ë‹¤ìš´ë¡œë“œ 주소와 ë²„ì „ì„ ì•Œë ¤ì£¼ì–´ì•¼í•©ë‹ˆë‹¤: +Node ëª¨ë“ˆì„ `node-gyp`를 사용하여 Electronì„ íƒ€ê²Ÿìœ¼ë¡œ 빌드할 때는 `node-gyp`ì— í—¤ë” ë‹¤ìš´ë¡œë“œ 주소와 ë²„ì „ì„ ì•Œë ¤ì£¼ì–´ì•¼ 합니다: ```bash $ cd /path-to-module/ @@ -43,7 +41,7 @@ $ HOME=~/.electron-gyp node-gyp rebuild --target=0.29.1 --arch=x64 --dist-url=ht ### npmì„ ì´ìš©í•œ 방법 ë˜í•œ `npm`ì„ ì‚¬ìš©í•˜ì—¬ ëª¨ë“ˆì„ ì„¤ì¹˜í•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. -환경변수가 필요한 ê²ƒì„ ì œì™¸í•˜ê³ ëŠ” ì¼ë°˜ Node ëª¨ë“ˆì„ ì„¤ì¹˜í•˜ëŠ” 방법과 완전히 똑같습니다: +환경변수가 필요한 ê²ƒì„ ì œì™¸í•˜ê³  ì¼ë°˜ Node ëª¨ë“ˆì„ ì„¤ì¹˜í•˜ëŠ” 방법과 완전히 똑같습니다: ```bash export npm_config_disturl=https://atom.io/download/atom-shell diff --git a/docs/api/content-tracing.md b/docs/api/content-tracing.md index 7d36fe9f5dd3..9161f5f362a1 100644 --- a/docs/api/content-tracing.md +++ b/docs/api/content-tracing.md @@ -8,11 +8,11 @@ generated file to view the result. ```javascript var contentTracing = require('content-tracing'); -tracing.startRecording('*', tracing.DEFAULT_OPTIONS, function() { +contentTracing.startRecording('*', contentTracing.DEFAULT_OPTIONS, function() { console.log('Tracing started'); setTimeout(function() { - tracing.stopRecording('', function(path) { + contentTracing.stopRecording('', function(path) { console.log('Tracing data recorded to ' + path); }); }, 5000); From ed01698444ed31f91aceb630054b61baadae0faa Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Mon, 31 Aug 2015 15:11:06 +0900 Subject: [PATCH 32/59] Update as upstream --- docs-translations/ko/api/auto-updater.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs-translations/ko/api/auto-updater.md b/docs-translations/ko/api/auto-updater.md index 369f58297be4..71005c3750c9 100644 --- a/docs-translations/ko/api/auto-updater.md +++ b/docs-translations/ko/api/auto-updater.md @@ -76,6 +76,12 @@ Squirrelì€ "url"ë¡œ `Accept: application/zip` í—¤ë”와 함께 ì—…ë°ì´íŠ¸ zip `pub_date`ì€ ISO 8601 í‘œì¤€ì— ë”°ë¼ í¬ë§·ëœ 날짜입니다. +## ì—…ë°ì´íŠ¸ 서버 구현 + +[Nuts](https://github.com/GitbookIO/nuts)는 위 ì—…ë°ì´íŠ¸ ì„œë²„ì˜ ì˜¤í”ˆ 소스 구현입니다. +ì´ êµ¬í˜„ì€ Github 릴리즈와 통합ë˜ì–´ 있습니다. Nuts는 `Squirrel.Mac`ê³¼ `Squirrel.Windows`를 지ì›í•˜ê³  다운로드와 ì—…ë°ì´íŠ¸ë¥¼ 관리합니다. +ì´ êµ¬í˜„ì„ ì‚¬ìš©í•˜ë©´ cross-platform 지ì›ì„ ì‹ ê²½ 쓸 필요가 없습니다. + ## Events `autoUpdater` ê°ì²´ëŠ” 다ìŒê³¼ ê°™ì€ ì´ë²¤íŠ¸ë¥¼ ë°œìƒì‹œí‚µë‹ˆë‹¤: From a6b86e924a97e0ef56687855c2a61bbf10749a02 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Mon, 31 Aug 2015 15:13:41 +0900 Subject: [PATCH 33/59] Small changes Improve grammar --- docs-translations/ko/api/auto-updater.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-translations/ko/api/auto-updater.md b/docs-translations/ko/api/auto-updater.md index 71005c3750c9..ca4da0043b07 100644 --- a/docs-translations/ko/api/auto-updater.md +++ b/docs-translations/ko/api/auto-updater.md @@ -78,8 +78,8 @@ Squirrelì€ "url"ë¡œ `Accept: application/zip` í—¤ë”와 함께 ì—…ë°ì´íŠ¸ zip ## ì—…ë°ì´íŠ¸ 서버 구현 -[Nuts](https://github.com/GitbookIO/nuts)는 위 ì—…ë°ì´íŠ¸ ì„œë²„ì˜ ì˜¤í”ˆ 소스 구현입니다. -ì´ êµ¬í˜„ì€ Github 릴리즈와 통합ë˜ì–´ 있습니다. Nuts는 `Squirrel.Mac`ê³¼ `Squirrel.Windows`를 지ì›í•˜ê³  다운로드와 ì—…ë°ì´íŠ¸ë¥¼ 관리합니다. +[Nuts](https://github.com/GitbookIO/nuts)는 위ì—ì„œ 설명한 ì—…ë°ì´íŠ¸ ì„œë²„ì˜ ì˜¤í”ˆ 소스 구현입니다. +ì´ êµ¬í˜„ì€ Github 릴리즈와 완벽하게 통합ë˜ì–´ 있습니다. Nuts는 `Squirrel.Mac`ê³¼ `Squirrel.Windows`를 지ì›í•˜ê³  다운로드와 ì—…ë°ì´íŠ¸ë¥¼ 관리합니다. ì´ êµ¬í˜„ì„ ì‚¬ìš©í•˜ë©´ cross-platform 지ì›ì„ ì‹ ê²½ 쓸 필요가 없습니다. ## Events From aed487ef40cff53652d288c243671dabd8a2510c Mon Sep 17 00:00:00 2001 From: Robo Date: Mon, 31 Aug 2015 00:22:01 +0530 Subject: [PATCH 34/59] app: add will-download event to defaultSession --- atom/browser/api/atom_api_session.cc | 33 ++++++++++++++++++++++++ atom/browser/api/atom_api_session.h | 8 +++++- atom/browser/api/atom_api_web_contents.h | 2 +- atom/browser/api/lib/app.coffee | 6 +++-- docs/api/app.md | 32 +++++++++++++++++++++++ 5 files changed, 77 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 9961d6cc6601..0b7640e416b5 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -9,6 +9,7 @@ #include "atom/browser/api/atom_api_cookies.h" #include "atom/browser/atom_browser_context.h" +#include "atom/browser/api/atom_api_web_contents.h" #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/file_path_converter.h" @@ -101,6 +102,19 @@ struct Converter { } }; +template<> +struct Converter { + static v8::Local ToV8(v8::Isolate* isolate, + content::DownloadItem* val) { + return mate::ObjectTemplateBuilder(isolate) + .SetValue("url", val->GetURL()) + .SetValue("filename", val->GetSuggestedFilename()) + .SetValue("mimeType", val->GetMimeType()) + .SetValue("hasUserGesture", val->HasUserGesture()) + .Build()->NewInstance(); + } +}; + } // namespace mate namespace atom { @@ -215,9 +229,28 @@ void SetProxyInIO(net::URLRequestContextGetter* getter, Session::Session(AtomBrowserContext* browser_context) : browser_context_(browser_context) { AttachAsUserData(browser_context); + // Observe DownloadManger to get download notifications. + auto download_manager = + content::BrowserContext::GetDownloadManager(browser_context); + download_manager->AddObserver(this); } Session::~Session() { + auto download_manager = + content::BrowserContext::GetDownloadManager(browser_context_); + download_manager->RemoveObserver(this); +} + +void Session::OnDownloadCreated(content::DownloadManager* manager, + content::DownloadItem* item) { + auto web_contents = item->GetWebContents(); + bool prevent_default = Emit("will-download", item, + api::WebContents::CreateFrom(isolate(), + web_contents)); + if (prevent_default) { + item->Cancel(true); + item->Remove(); + } } void Session::ResolveProxy(const GURL& url, ResolveProxyCallback callback) { diff --git a/atom/browser/api/atom_api_session.h b/atom/browser/api/atom_api_session.h index b353c61c2109..c06348974ff4 100644 --- a/atom/browser/api/atom_api_session.h +++ b/atom/browser/api/atom_api_session.h @@ -8,6 +8,7 @@ #include #include "atom/browser/api/trackable_object.h" +#include "content/public/browser/download_manager.h" #include "native_mate/handle.h" #include "net/base/completion_callback.h" @@ -27,7 +28,8 @@ class AtomBrowserContext; namespace api { -class Session: public mate::TrackableObject { +class Session: public mate::TrackableObject, + public content::DownloadManager::Observer { public: using ResolveProxyCallback = base::Callback; @@ -41,6 +43,10 @@ class Session: public mate::TrackableObject { explicit Session(AtomBrowserContext* browser_context); ~Session(); + // content::DownloadManager::Observer: + void OnDownloadCreated(content::DownloadManager* manager, + content::DownloadItem* item) override; + // mate::Wrappable implementations: mate::ObjectTemplateBuilder GetObjectTemplateBuilder( v8::Isolate* isolate) override; diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 2fbc1d899777..45027309ea65 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -10,8 +10,8 @@ #include "atom/browser/api/trackable_object.h" #include "atom/browser/common_web_contents_delegate.h" -#include "content/public/common/favicon_url.h" #include "content/public/browser/web_contents_observer.h" +#include "content/public/common/favicon_url.h" #include "native_mate/handle.h" #include "ui/gfx/image/image.h" diff --git a/atom/browser/api/lib/app.coffee b/atom/browser/api/lib/app.coffee index 3e05106d1927..f71297c596f0 100644 --- a/atom/browser/api/lib/app.coffee +++ b/atom/browser/api/lib/app.coffee @@ -32,8 +32,10 @@ app.setAppPath = (path) -> app.getAppPath = -> appPath -# Be compatible with old API. -app.once 'ready', -> @emit 'finish-launching' +app.once 'ready', -> + app.defaultSession.__proto__ = EventEmitter.prototype + # Be compatible with old API. + @emit 'finish-launching' app.terminate = app.quit app.exit = process.exit app.getHomeDir = -> @getPath 'home' diff --git a/docs/api/app.md b/docs/api/app.md index db34d37ec59e..8951adf45cfd 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -330,3 +330,35 @@ Sets the application's [dock menu][dock-menu]. [dock-menu]:https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/customizing_docktile/concepts/dockconcepts.html#//apple_ref/doc/uid/TP30000986-CH2-TPXREF103 [tasks]:http://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks + +## `app.defaultSession` + +The default session of the app available once the (ready)[app.md#event-ready] event is fired. + +```javascript +app.on('ready', function() { + var defaultSession = app.defaultSession; +}) +``` + +### Event: 'will-download' + +* `event` Event +* `downloadItem` Object + * `url` String + * `filename` String + * `mimeType` String + * `hasUserGesture` Boolean +* `webContents` (WebContents)[web-contents.md] + +Fired when a download is about to start. Calling `preventDefault()` +will cancel the download. + +```javascript +app.defaultSession.on('will-download', function(e, downloadItem, webContents) { + e.preventDefault(); + require('request')(downloadItem.url, function(data) { + require('fs').writeFileSync('/somewhere', data); + }); +}); +``` From af52eda0eb224ce3081d1a8c8c95d6c97dccd2e7 Mon Sep 17 00:00:00 2001 From: Robo Date: Sat, 29 Aug 2015 20:44:52 +0530 Subject: [PATCH 35/59] process: api to set file descriptor soft limit --- atom/common/api/atom_bindings.cc | 4 ++++ docs/api/app.md | 1 - docs/api/process.md | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index c748647f48d0..d6fb355e09d8 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -11,6 +11,7 @@ #include "atom/common/chrome_version.h" #include "atom/common/native_mate_converters/string16_converter.h" #include "base/logging.h" +#include "base/process/process_metrics.h" #include "native_mate/dictionary.h" #include "atom/common/node_includes.h" @@ -61,6 +62,9 @@ void AtomBindings::BindTo(v8::Isolate* isolate, dict.SetMethod("crash", &Crash); dict.SetMethod("hang", &Hang); dict.SetMethod("log", &Log); +#if defined(OS_POSIX) + dict.SetMethod("setFdLimit", &base::SetFdLimit); +#endif dict.SetMethod("activateUvLoop", base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this))); diff --git a/docs/api/app.md b/docs/api/app.md index db34d37ec59e..07b26f2c5663 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -269,7 +269,6 @@ Adds `tasks` to the [Tasks][tasks] category of the JumpList on Windows. consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0. - ### `app.commandLine.appendSwitch(switch[, value])` Append a switch (with optional `value`) to Chromium's command line. diff --git a/docs/api/process.md b/docs/api/process.md index c9efa22fe0f9..930a5860fc44 100644 --- a/docs/api/process.md +++ b/docs/api/process.md @@ -11,3 +11,10 @@ upstream node: ## process.hang Causes the main thread of the current process hang. + +## process.setFdLimit(maxDescriptors) _OS X_ _Linux_ + +* `maxDescriptors` Integer + +Sets the file descriptor soft limit to `maxDescriptors` or the OS hard +limit, whichever is lower for the current process. From 9ecc4bcb7d858b3cd0f80bc37fdb459768ea07be Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 31 Aug 2015 21:38:18 +0800 Subject: [PATCH 36/59] Fork renderer process for webview Previously it was disabled because Chrome doesn't support swapping renderer process before, it seeems to work fine now, so we enable it to see how it goes. --- atom/renderer/atom_renderer_client.cc | 19 ++++--------------- atom/renderer/lib/init.coffee | 2 -- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 86c9eb1cdeb6..21ced4aedb86 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -52,10 +52,6 @@ bool IsSwitchEnabled(base::CommandLine* command_line, return true; } -bool IsGuestFrame(blink::WebFrame* frame) { - return frame->uniqueName().utf8() == "ATOM_SHELL_GUEST_WEB_VIEW"; -} - // global.Uint8Array; v8::Local GetUint8ArrayConstructor( v8::Isolate* isolate, v8::Local context) { @@ -189,14 +185,11 @@ bool AtomRendererClient::OverrideCreatePlugin( void AtomRendererClient::DidCreateScriptContext( blink::WebFrame* frame, v8::Handle context) { - // Only attach node bindings in main frame or guest frame. - if (!IsGuestFrame(frame)) { - if (main_frame_) - return; + if (main_frame_) + return; - // The first web frame is the main frame. - main_frame_ = frame; - } + // The first web frame is the main frame. + main_frame_ = frame; // Give the node loop a run to make sure everything is ready. node_bindings_->RunMessageLoop(); @@ -221,10 +214,6 @@ bool AtomRendererClient::ShouldFork(blink::WebFrame* frame, bool is_initial_navigation, bool is_server_redirect, bool* send_referrer) { - // Never fork renderer process for guests. - if (IsGuestFrame(frame)) - return false; - // Handle all the navigations and reloads in browser. // FIXME We only support GET here because http method will be ignored when // the OpenURLFromTab is triggered, which means form posting would not work, diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index 32d3ee76d1b9..9825f75be928 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -29,8 +29,6 @@ for arg in process.argv if arg.indexOf('--guest-instance-id=') == 0 # This is a guest web view. process.guestInstanceId = parseInt arg.substr(arg.indexOf('=') + 1) - # Set the frame name to make AtomRendererClient recognize this guest. - require('web-frame').setName 'ATOM_SHELL_GUEST_WEB_VIEW' else if arg.indexOf('--node-integration=') == 0 nodeIntegration = arg.substr arg.indexOf('=') + 1 else if arg.indexOf('--preload=') == 0 From ebedb606843056bab9f16946a0812432e437c8f2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 31 Aug 2015 21:59:13 +0800 Subject: [PATCH 37/59] Insert node integration for all main frames --- atom/renderer/atom_renderer_client.cc | 9 +++------ atom/renderer/atom_renderer_client.h | 3 --- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 21ced4aedb86..e17e8bf3db9b 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -109,8 +109,7 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver { AtomRendererClient::AtomRendererClient() : node_bindings_(NodeBindings::Create(false)), - atom_bindings_(new AtomBindings), - main_frame_(nullptr) { + atom_bindings_(new AtomBindings) { } AtomRendererClient::~AtomRendererClient() { @@ -185,12 +184,10 @@ bool AtomRendererClient::OverrideCreatePlugin( void AtomRendererClient::DidCreateScriptContext( blink::WebFrame* frame, v8::Handle context) { - if (main_frame_) + // Only insert node integration for the main frame. + if (frame->parent()) return; - // The first web frame is the main frame. - main_frame_ = frame; - // Give the node loop a run to make sure everything is ready. node_bindings_->RunMessageLoop(); diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index 68201f3cd435..e59547cf8eb1 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -64,9 +64,6 @@ class AtomRendererClient : public content::ContentRendererClient, scoped_ptr node_bindings_; scoped_ptr atom_bindings_; - // The main frame. - blink::WebFrame* main_frame_; - DISALLOW_COPY_AND_ASSIGN(AtomRendererClient); }; From 625ee387f3fbf9cac3cb3c71fd5b8aa5143cf312 Mon Sep 17 00:00:00 2001 From: huangruichang <532079207@qq.com> Date: Tue, 1 Sep 2015 00:34:00 +0800 Subject: [PATCH 38/59] * add quick-start.md for zh-CN --- .../zh-CN/tutorial/quick-start.md | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 docs-translations/zh-CN/tutorial/quick-start.md diff --git a/docs-translations/zh-CN/tutorial/quick-start.md b/docs-translations/zh-CN/tutorial/quick-start.md new file mode 100644 index 000000000000..fe54cbe9e308 --- /dev/null +++ b/docs-translations/zh-CN/tutorial/quick-start.md @@ -0,0 +1,136 @@ +# 快速入门 + +## 简介 +Electron å¯ä»¥è®©ä½ ä½¿ç”¨çº¯ JavaScript 调用丰富的原生 APIs æ¥åˆ›é€ æ¡Œé¢åº”用。你å¯ä»¥æŠŠå®ƒçœ‹ä½œæ˜¯ä¸“注于桌é¢åº”用而ä¸æ˜¯ web æœåŠ¡å™¨çš„,io.js 的一个å˜ä½“。 + +è¿™ä¸æ„å‘³ç€ Electron 是绑定了 GUI 库的 JavaScript。相å,Electron 使用 web 页é¢ä½œä¸ºå®ƒçš„ GUI,所以你能把它看作æˆä¸€ä¸ªè¢« JavaScript 控制的,精简版的 Chromium æµè§ˆå™¨ã€‚ + +## 主进程 +在 Electron 里,è¿è¡Œ `package.json` 里 `main` 脚本的进程被称为**主进程**。在主进程è¿è¡Œçš„脚本å¯ä»¥ä»¥åˆ›å»º web 页é¢çš„å½¢å¼å±•ç¤º GUI。 + +## 渲染进程 +由于 Electron 使用 Chromium æ¥å±•ç¤ºé¡µé¢ï¼Œæ‰€ä»¥ Chromium 的多进程结构也被充分利用。æ¯ä¸ª Electron 的页é¢éƒ½åœ¨è¿è¡Œç€è‡ªå·±çš„进程,这样的进程我们称之为**渲染进程**。 + +在一般æµè§ˆå™¨ä¸­ï¼Œç½‘页通常会在沙盒环境下è¿è¡Œï¼Œå¹¶ä¸”ä¸å…许访问原生资æºã€‚然åŽï¼ŒElectron 用户拥有在网页中调用 io.js çš„ APIs 的能力,从而创造出低等的ã€ä¸Žæ“作系统的交互。 + +## 主进程与渲染进程的区别 +主进程使用 BroswerWindow 实例创建网页。æ¯ä¸ª BroswerWindow 实例都在自己的渲染进程里è¿è¡Œç€ä¸€ä¸ªç½‘页。当一个 BroswerWindow 实例被销æ¯ï¼Œç›¸åº”的渲染进程也会被终止。 + +主进程管ç†æ‰€æœ‰é¡µé¢å’Œä¸Žä¹‹å¯¹åº”的渲染进程。æ¯ä¸ªæ¸²æŸ“进程都是相互独立的,并且åªå…³å¿ƒä»–们自己的网页。 + +由于在网页里管ç†åŽŸç”Ÿ GUI 资æºæ˜¯éžå¸¸å±é™©è€Œä¸”容易造æˆèµ„æºæ³„露的,所以在网页é¢è°ƒç”¨ GUI 相关的 APIs 是ä¸è¢«å…许的。如果你想在网页里使用 GUI æ“作,其对应的渲染进程必须与主进程进行通讯,请求主进程进行相关的 GUI æ“作。 + +在 Electron,我们æ供用于在主进程与渲染进程之间通讯的 [ipc][1] 模å—ã€‚å¹¶ä¸”ä¹Ÿæœ‰ä¸€ä¸ªè¿œç¨‹è¿›ç¨‹è°ƒç”¨é£Žæ ¼çš„é€šè®¯æ¨¡å— [remote][2]。 + +# 打造你第一个 Electron 应用 +大体上,一个 Electron 应用的目录结构如下: +```` +your-app/ +├── package.json +├── main.js +└── index.html +```` +`package.json `çš„æ ¼å¼å’Œ Node 的完全一致,并且那个被 `main` 字段声明的脚本文件是你的应用的å¯åŠ¨è„šæœ¬ï¼Œå®ƒè¿è¡Œåœ¨ä¸»è¿›ç¨‹ä¸Šã€‚你应用里的 `package.json` 看起æ¥åº”该åƒï¼š +```` +{ + "name" : "your-app", + "version" : "0.1.0", + "main" : "main.js" +} +```` +**注æ„**:如果 `main` 字段没有在 `package.json` 声明,Electron会优先加载 `index.js`。 + +`main.js` 应该用于创建窗å£å’Œå¤„ç†ç³»ç»Ÿæ—¶é—´ï¼Œä¸€ä¸ªå…¸åž‹çš„例å­å¦‚下: +```` +var app = require('app'); // 控制应用生命周期的模å—。 +var BrowserWindow = require('browser-window'); // 创建原生æµè§ˆå™¨çª—å£çš„æ¨¡å— + +// 给我们的æœåŠ¡å™¨å‘é€å¼‚常报告。 +require('crash-reporter').start(); + +// ä¿æŒä¸€ä¸ªå¯¹äºŽ window 对象的全局引用,ä¸ç„¶ï¼Œå½“ JavaScript 被 GC, +// window 会被自动地关闭 +var mainWindow = null; + +// 当所有窗å£è¢«å…³é—­äº†ï¼Œé€€å‡ºã€‚ +app.on('window-all-closed', function() { + // 在 OS X 上,通常用户在明确地按下 Cmd + Q ä¹‹å‰ + // 应用会ä¿æŒæ´»åŠ¨çŠ¶æ€ + if (process.platform != 'darwin') { + app.quit(); + } +}); + +// 当 Electron 完æˆäº†åˆå§‹åŒ–并且准备创建æµè§ˆå™¨çª—å£çš„时候 +// 这个方法就被调用 +app.on('ready', function() { + // 创建æµè§ˆå™¨çª—å£ã€‚ + mainWindow = new BrowserWindow({width: 800, height: 600}); + + // 加载应用的 index.html + mainWindow.loadUrl('file://' + __dirname + '/index.html'); + + // 打开开å‘工具 + mainWindow.openDevTools(); + + // 当 window 被关闭,这个事件会被å‘出 + mainWindow.on('closed', function() { + // å–消引用 window 对象,如果你的应用支æŒå¤šçª—å£çš„è¯ï¼Œ + // 通常会把多个 window 对象存放在一个数组里é¢ï¼Œ + // 但这次ä¸æ˜¯ã€‚ + mainWindow = null; + }); +}); +```` +最åŽï¼Œä½ æƒ³å±•ç¤ºçš„ `index.html` : +```` + + + + Hello World! + + +

Hello World!

+ We are using io.js + and Electron . + + +```` + +# è¿è¡Œä½ çš„应用 +一旦你创建了最åˆçš„ `main.js`, `index.html` å’Œ `package.json` 这几个文件,你å¯èƒ½ä¼šæƒ³å°è¯•åœ¨æœ¬åœ°è¿è¡Œå¹¶æµ‹è¯•ï¼Œçœ‹çœ‹æ˜¯ä¸æ˜¯å’ŒæœŸæœ›çš„那样正常è¿è¡Œã€‚ + +## electron-prebuild +如果你已ç»ç”¨ `npm` 全局安装了 `electron-prebuilt`,你åªéœ€è¦æŒ‰ç…§å¦‚下方å¼ç›´æŽ¥è¿è¡Œä½ çš„应用: +```` +electron . +```` +如果你是局部安装,那è¿è¡Œï¼š +```` +./node_modules/.bin/electron . +```` + +## 手工下载 Electron 二进制文件 +如果你手工下载了 Electron 的二进制文件,你也å¯ä»¥ç›´æŽ¥ä½¿ç”¨å…¶ä¸­çš„二进制文件直接è¿è¡Œä½ çš„应用。 +### Windows +```` +$ .\electron\electron.exe your-app\ +```` +### Linux +```` +$ ./electron/electron your-app/ +```` +### OS X +```` +$ ./Electron.app/Contents/MacOS/Electron your-app/ +```` +`Electron.app` 里é¢æ˜¯ Electron å‘布包,你å¯ä»¥åœ¨[这里][3]下载到。 + +# 以å‘行版本è¿è¡Œ +在你完æˆäº†ä½ çš„应用åŽï¼Œä½ å¯ä»¥æŒ‰ç…§[应用部署][4]指导å‘布一个版本,并且以已ç»æ‰“包好的形å¼è¿è¡Œåº”用。 + + + [1]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/api/ipc-renderer.md + [2]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/api/remote.md + [3]: https://github.com/atom/electron/releases + [4]: https://github.com/atom/electron/blob/master/docs-translations/zh-CN/tutorial/application-distribution.md \ No newline at end of file From afff32dc8dbae0ec58a26809a81cf1543079da47 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Tue, 1 Sep 2015 08:09:35 +0900 Subject: [PATCH 39/59] Improve grammar --- docs-translations/ko/api/window-open.md | 6 +++--- docs-translations/ko/tutorial/quick-start.md | 11 ++++++----- .../ko/tutorial/using-native-node-modules.md | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs-translations/ko/api/window-open.md b/docs-translations/ko/api/window-open.md index d4e0509e9ec6..706d7e090bb8 100644 --- a/docs-translations/ko/api/window-open.md +++ b/docs-translations/ko/api/window-open.md @@ -1,9 +1,9 @@ # `window.open` 메서드 -`window.open` 메서드가 호출ë˜ë©´ 새 ì°½ì—ì„œ 새로운 페ì´ì§€ë¥¼ 불러옵니다. -ì´ ì°½ì€ `url`ë¡œ 부터 만들어진 `BrowserWindow`ì˜ ìƒˆ ì¸ìŠ¤í„´ìŠ¤ì´ë©° 본 ê°ì²´ 대신 페ì´ì§€ì˜ ì»¨íŠ¸ë¡¤ì´ ì œí•œëœ í”„ë¡ì‹œ ê°ì²´ë¥¼ 반환합니다. +`window.open` 메서드가 호출ë˜ë©´ 새 ì°½ì„ ìƒì„±í•˜ê³  `url` 페ì´ì§€ë¥¼ 불러옵니다. +ì´ ì°½ì€ ì§€ì •í•œ `url`ì„ ë¡œë“œí•˜ì—¬ 만들어진 `BrowserWindow`ì˜ ìƒˆ ì¸ìŠ¤í„´ìŠ¤ì´ë©° 본래 ì°½ ê°ì²´ 대신 페ì´ì§€ì˜ ì»¨íŠ¸ë¡¤ì´ ì œí•œëœ í”„ë¡ì‹œ ê°ì²´ë¥¼ 반환합니다. -프ë¡ì‹œ ê°ì²´ëŠ” ê¸°ì¡´ì˜ ì›¹ 페ì´ì§€ì™€ í˜¸í™˜ë  ìˆ˜ 있ë„ë¡ ì¼ë¶€ ì œí•œëœ í‘œì¤€ 기능만 가지고 있습니다. +프ë¡ì‹œ ê°ì²´ëŠ” 브ë¼ìš°ì €ì˜ 웹 페ì´ì§€ 창과 í˜¸í™˜ë  ìˆ˜ 있ë„ë¡ ì¼ë¶€ ì œí•œëœ í‘œì¤€ 기능만 가지고 있습니다. ì°½ì˜ ëª¨ë“  ì»¨íŠ¸ë¡¤ì„ ê°€ì§€ë ¤ë©´ `BrowserWindow`를 ì§ì ‘ ìƒì„±í•˜ì—¬ 작업해야 합니다. ## window.open(url, [frameName[, features]]) diff --git a/docs-translations/ko/tutorial/quick-start.md b/docs-translations/ko/tutorial/quick-start.md index 963ebca4dacd..39d9edfdbfb4 100644 --- a/docs-translations/ko/tutorial/quick-start.md +++ b/docs-translations/ko/tutorial/quick-start.md @@ -10,23 +10,24 @@ Electronì€ ìžë°”스í¬ë¦½íŠ¸ì™€ 함께 ì œê³µëœ í’부한 네ì´í‹°ë¸Œ API를 ### ë©”ì¸ í”„ë¡œì„¸ìŠ¤ -Electronì€ ì‹¤í–‰ë  ë•Œ __ë©”ì¸ í”„ë¡œì„¸ìŠ¤__ ë¡œ 불리는 `package.json`ì˜ `main` 스í¬ë¦½íŠ¸ë¥¼ 호출합니다. +Electronì€ ì‹¤í–‰ë  ë•Œ __ë©”ì¸ í”„ë¡œì„¸ìŠ¤__ë¡œ 불리는 `package.json`ì˜ `main` 스í¬ë¦½íŠ¸ë¥¼ 호출합니다. ì´ ìŠ¤í¬ë¦½íŠ¸ëŠ” ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ ìž‘ë™í•©ë‹ˆë‹¤. GUI ì»´í¬ë„ŒíŠ¸ë¥¼ 조작하거나 웹 페ì´ì§€ ì°½ì„ ìƒì„±í•  수 있습니다. ### ëžœë”러 프로세스 Electronì´ ì›¹íŽ˜ì´ì§€ë¥¼ 보여줄 ë•Œ Chromiumì˜ multi-processes êµ¬ì¡°ë„ ê°™ì´ ì‚¬ìš©ë©ë‹ˆë‹¤. -Electron 프로세스 ë‚´ì—ì„œ ìž‘ë™í•˜ëŠ” 웹 페ì´ì§€ëŠ” __ëžœë”러 프로세스__ ë¼ê³  불립니다. +Electron 프로세스 ë‚´ì—ì„œ ìž‘ë™í•˜ëŠ” 웹 페ì´ì§€ë¥¼ __ëžœë”러 프로세스__ ë¼ê³  불립니다. 보통 ì¼ë°˜ 브ë¼ìš°ì €ì˜ 웹 페ì´ì§€ë“¤ì€ 샌드박스가 ì ìš©ëœ 환경ì—ì„œ ìž‘ë™í•˜ë©° 네ì´í‹°ë¸Œ 리소스ì—는 접근할 수 ì—†ë„ë¡ ë˜ì–´ 있습니다. 하지만 Electronì€ ì›¹ 페ì´ì§€ ë‚´ì—ì„œ io.js(node.js) API를 사용하여 low-level 수준으로 ìš´ì˜ì²´ì œì™€ ìƒí˜¸ìž‘ìš©í•  수 있습니다. ### ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì™€ ëžœë”러 í”„ë¡œì„¸ìŠ¤ì˜ ì°¨ì´ì  -ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” `BrowserWindow` Class를 ì´ìš©í•˜ì—¬ ì°½ì„ ë§Œë“¤ 수 있습니다. `BrowserWindow` ì¸ìŠ¤í„´ìŠ¤ëŠ” -ë”°ë¡œ ë¶„ë¦¬ëœ í”„ë¡œì„¸ìŠ¤ì—ì„œ ëžœë”ë§ ë˜ë©° `BrowserWindow` ì¸ìŠ¤í„´ìŠ¤ê°€ 소멸할 ë•Œ 해당하는 ëžœë”러 í”„ë¡œì„¸ìŠ¤ë„ ê°™ì´ ì†Œë©¸í•©ë‹ˆë‹¤. +ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” `BrowserWindow` Class를 사용하여 새로운 ì°½ì„ ë§Œë“¤ 수 있습니다. +`BrowserWindow` ì¸ìŠ¤í„´ìŠ¤ëŠ” ë”°ë¡œ ë¶„ë¦¬ëœ í”„ë¡œì„¸ìŠ¤ì—ì„œ ëžœë”ë§ ë˜ë©° ì´ í”„ë¡œì„¸ìŠ¤ë¥¼ ëžœë”러 프로세스ë¼ê³  합니다. +`BrowserWindow` ì¸ìŠ¤í„´ìŠ¤ê°€ 소멸할 ë•Œ ê·¸ ì°½ì˜ ëžœë”러 í”„ë¡œì„¸ìŠ¤ë„ ê°™ì´ ì†Œë©¸í•©ë‹ˆë‹¤. -ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” 모든 웹 페ì´ì§€ì™€ ê·¸ì— í•´ë‹¹í•˜ëŠ” ëžœë”러 프로세스를 관리하며 +ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” 모든 웹 페ì´ì§€ì™€ ëžœë”러 프로세스를 관리하며 ëžœë”러 프로세스는 ê°ê°ì˜ í”„ë¡œì„¸ìŠ¤ì— ê³ ë¦½ë˜ë©° 웹 페ì´ì§€ì˜ ìž‘ë™ì—만 ì˜í–¥ì„ ë¼ì¹©ë‹ˆë‹¤. 웹 페ì´ì§€ ë‚´ì—ì„œ 네ì´í‹°ë¸Œ GUI 리소스를 관리하는 ê²ƒì€ ë³´ì•ˆì— ì·¨ì•½í•˜ê³  리소스를 누수시킬 수 있기 ë•Œë¬¸ì— diff --git a/docs-translations/ko/tutorial/using-native-node-modules.md b/docs-translations/ko/tutorial/using-native-node-modules.md index 1dd23e5f1dcf..5b8f71210550 100644 --- a/docs-translations/ko/tutorial/using-native-node-modules.md +++ b/docs-translations/ko/tutorial/using-native-node-modules.md @@ -1,4 +1,4 @@ -# 네ì´í‹°ë¸Œ node 모듈 사용하기 +# 네ì´í‹°ë¸Œ node 모듈 사용하기 Electronì—ì„  node.js 네ì´í‹°ë¸Œ ëª¨ë“ˆì´ ì§€ì›ë©ë‹ˆë‹¤. 하지만 Electronì€ ê³µì‹ node.jsì˜ V8 엔진과는 다른 V8 ë²„ì „ì„ ì‚¬ìš©í•©ë‹ˆë‹¤. ì´ëŸ¬í•œ ì´ìœ ë¡œ 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ì‚¬ìš©í•˜ê¸° 위해선 Electronì˜ V8 ë²„ì „ì— ë§žì¶° 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë‹¤ì‹œ 빌드하고 í—¤ë”를 변경해야 합니다. @@ -14,7 +14,7 @@ Node v0.11.x 버전부터는 V8 APIì˜ ì¤‘ëŒ€í•œ ë³€ê²½ì´ ìžˆì—ˆìŠµë‹ˆë‹¤. 하 ## 네ì´í‹°ë¸Œ 모듈 설치하는 방법 -### 쉬운 방법 - 권장 +### 쉬운 방법 [`electron-rebuild`](https://github.com/paulcbetts/electron-rebuild) 패키지를 사용하면 빠르고 간단하게 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë‹¤ì‹œ 빌드할 수 있습니다. 간단한 절차를 통해 ìžë™ìœ¼ë¡œ í—¤ë”를 다운로드하고 네ì´í‹°ë¸Œ ëª¨ë“ˆì„ ë¹Œë“œí•  수 있습니다: From eb3769f98e0386e221d8b06fec082b303cbc8afc Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Tue, 1 Sep 2015 09:57:43 +0900 Subject: [PATCH 40/59] Update as upstream, improve grammar --- README-ko.md | 2 +- docs-translations/ko/api/auto-updater.md | 2 +- docs-translations/ko/api/clipboard.md | 2 +- docs-translations/ko/api/crash-reporter.md | 2 +- docs-translations/ko/api/dialog.md | 2 +- docs-translations/ko/api/global-shortcut.md | 19 ++++--- docs-translations/ko/api/ipc-main-process.md | 51 ++++++++++++++----- docs-translations/ko/api/ipc-renderer.md | 46 ++++++++++++----- docs-translations/ko/api/menu.md | 2 +- .../ko/api/power-save-blocker.md | 2 +- docs-translations/ko/api/process.md | 6 +++ docs-translations/ko/api/protocol.md | 2 +- docs-translations/ko/api/remote.md | 2 +- docs-translations/ko/api/tray.md | 2 +- docs-translations/ko/api/window-open.md | 4 +- .../development/atom-shell-vs-node-webkit.md | 2 +- .../development/build-instructions-linux.md | 4 +- .../ko/development/build-instructions-mac.md | 2 +- .../development/build-instructions-windows.md | 4 +- docs-translations/ko/styleguide.md | 2 +- .../ko/tutorial/application-packaging.md | 2 +- .../ko/tutorial/debugging-main-process.md | 4 +- .../ko/tutorial/online-offline-events.md | 8 +-- docs-translations/ko/tutorial/quick-start.md | 2 +- .../ko/tutorial/using-native-node-modules.md | 2 +- .../ko/tutorial/using-pepper-flash-plugin.md | 3 +- 26 files changed, 119 insertions(+), 62 deletions(-) diff --git a/README-ko.md b/README-ko.md index 00cfe43732de..1b895c159798 100644 --- a/README-ko.md +++ b/README-ko.md @@ -6,7 +6,7 @@ ### [Electron](https://github.com/atom/electron/) 한국어 참조문서 -:zap: *ì´ì „까지 Atom Shellë¡œ 알려져 있었습니다* :zap: +:zap: *í”„ë ˆìž„ì›Œí¬ ì´ë¦„ì´ Atom Shellì—ì„œ Electron으로 바뀌었습니다* :zap: Electron 프레임워í¬ëŠ” JavaScript, HTML 그리고 CSS를 사용하여 Cross-Platform ë°ìŠ¤í¬í†± 어플리케ì´ì…˜ì„ 개발할 수 있ë„ë¡ í•´ì£¼ëŠ” 프레임워í¬ìž…니다. ì´ í”„ë ˆìž„ì›Œí¬ëŠ” [io.js](http://iojs.org) 와 [Chromium](http://www.chromium.org)ì„ ê¸°ë°˜ìœ¼ë¡œ 만들어 졌으며 [Atom Editor](https://github.com/atom/atom)ì— ì‚¬ìš©ë˜ê³  있습니다. diff --git a/docs-translations/ko/api/auto-updater.md b/docs-translations/ko/api/auto-updater.md index ca4da0043b07..1b586d5cdd5d 100644 --- a/docs-translations/ko/api/auto-updater.md +++ b/docs-translations/ko/api/auto-updater.md @@ -17,7 +17,7 @@ Squirrelì€ ì–´í”Œë¦¬ì¼€ì´ì…˜ì´ **안전하고 투명한 ì—…ë°ì´íŠ¸**를 ì œ Squirrelì€ ì‚¬ìš©ìžì—게 어플리케ì´ì…˜ì˜ ì—…ë°ì´íŠ¸ë¥¼ 알릴 í•„ìš” ì—†ì´ ì„œë²„ê°€ 지시하는 ë²„ì „ì„ ë°›ì•„ì˜¨ 후 ìžë™ìœ¼ë¡œ ì—…ë°ì´íŠ¸í•©ë‹ˆë‹¤. ì´ ê¸°ëŠ¥ì„ ì‚¬ìš©í•˜ë©´ Squirrelì„ í†µí•´ í´ë¼ì´ì–¸íŠ¸ì˜ 어플리케ì´ì…˜ì„ 지능ì ìœ¼ë¡œ ì—…ë°ì´íŠ¸ í•  수 있습니다. -요청시 커스텀 í—¤ë” ë˜ëŠ” 요청 ë³¸ë¬¸ì— ì¸ì¦ 정보를 í¬í•¨ì‹œí‚¬ ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +ë˜í•œ 요청시 커스텀 í—¤ë” ë˜ëŠ” 요청 ë³¸ë¬¸ì— ì¸ì¦ 정보를 í¬í•¨ì‹œí‚¬ 수 있습니다. 서버ì—ì„  ì´ëŸ¬í•œ ìš”ì²­ì„ ë¶„ë¥˜ 처리하여 ì ë‹¹í•œ ì—…ë°ì´íŠ¸ë¥¼ 제공할 수 있습니다. Squirrel JSON ì—…ë°ì´íŠ¸ 요청시 처리는 반드시 ì–´ë–¤ ì—…ë°ì´íŠ¸ê°€ 필요한지 ìš”ì²­ì˜ ê¸°ì¤€ì— ë§žì¶° ë™ì ìœ¼ë¡œ ìƒì„±ë˜ì–´ì•¼ 합니다. diff --git a/docs-translations/ko/api/clipboard.md b/docs-translations/ko/api/clipboard.md index 5143a4c3b113..080078274e01 100644 --- a/docs-translations/ko/api/clipboard.md +++ b/docs-translations/ko/api/clipboard.md @@ -19,7 +19,7 @@ console.log(clipboard.readText('selection')); `clipboard` ëª¨ë“ˆì€ ë‹¤ìŒê³¼ ê°™ì€ ë©”ì„œë“œë¥¼ 가지고 있습니다: -**알림:** Experimental 마í¬ê°€ ë¶™ì€ API는 실험ì ì¸ 기능ì´ë©° 차후 최신 버전ì—ì„œ ì œê±°ë  ìˆ˜ 있습니다. +**참고:** Experimental 마í¬ê°€ ë¶™ì€ API는 실험ì ì¸ 기능ì´ë©° 차후 최신 버전ì—ì„œ ì œê±°ë  ìˆ˜ 있습니다. ### `clipboard.readText([type])` diff --git a/docs-translations/ko/api/crash-reporter.md b/docs-translations/ko/api/crash-reporter.md index 53b5d3b7924c..3a7bc35f0982 100644 --- a/docs-translations/ko/api/crash-reporter.md +++ b/docs-translations/ko/api/crash-reporter.md @@ -37,7 +37,7 @@ crashReporter.start({ 다른 crashReporter API를 사용하기 ì „ì— ì´ ë©”ì„œë“œë¥¼ 먼저 호출해야 합니다. -**알림:** OS Xì—ì„  Windows와 Linuxì˜ `breakpad`와 달리 새로운 `crashpad` í´ë¼ì´ì–¸íŠ¸ë¥¼ 사용합니다. +**참고:** OS Xì—ì„  Windows와 Linuxì˜ `breakpad`와 달리 새로운 `crashpad` í´ë¼ì´ì–¸íŠ¸ë¥¼ 사용합니다. 오류 수집 ê¸°ëŠ¥ì„ í™œì„±í™” 시키려면 오류를 수집하고 ì‹¶ì€ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë‚˜ ëžœë”러 프로세스ì—ì„œ `crashReporter.start` 메서드를 호출하여 `crashpad`를 초기화 해야합니다. diff --git a/docs-translations/ko/api/dialog.md b/docs-translations/ko/api/dialog.md index 0c8bdec74a66..08530c054797 100644 --- a/docs-translations/ko/api/dialog.md +++ b/docs-translations/ko/api/dialog.md @@ -52,7 +52,7 @@ console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', ' `callback`ì´ ì „ë‹¬ë˜ë©´ 메소드가 비ë™ê¸°ë¡œ ìž‘ë™ë˜ë©° 결과는 `callback(filenames)`ì„ í†µí•´ 전달ë©ë‹ˆë‹¤. -**알림:** Windows와 Linuxì—ì„  íŒŒì¼ ì„ íƒ ëª¨ë“œ, 디렉터리 ì„ íƒ ëª¨ë“œë¥¼ ë™ì‹œì— 사용할 수 없습니다. +**참고:** Windows와 Linuxì—ì„  íŒŒì¼ ì„ íƒ ëª¨ë“œ, 디렉터리 ì„ íƒ ëª¨ë“œë¥¼ ë™ì‹œì— 사용할 수 없습니다. ì´ëŸ¬í•œ ì´ìœ ë¡œ `properties`를 `['openFile', 'openDirectory']`ë¡œ 설정하면 디렉터리 ì„ íƒ ëŒ€í™” ìƒìžê°€ 표시ë©ë‹ˆë‹¤. ### `dialog.showSaveDialog([browserWindow][, options][, callback])` diff --git a/docs-translations/ko/api/global-shortcut.md b/docs-translations/ko/api/global-shortcut.md index d99085f448e5..b6ad3fe89b86 100644 --- a/docs-translations/ko/api/global-shortcut.md +++ b/docs-translations/ko/api/global-shortcut.md @@ -1,8 +1,9 @@ # global-shortcut -`global-shortcut` ëª¨ë“ˆì€ ìš´ì˜ì²´ì œì˜ ì „ì—­ 키보드 단축키를 설정 등ë¡/í•´ì œ 하는 ë°©ë²•ì„ ì œê³µí•©ë‹ˆë‹¤. +`global-shortcut` ëª¨ë“ˆì€ ìš´ì˜ì²´ì œì˜ ì „ì—­ 키보드 단축키를 등ë¡/í•´ì œ 하는 ë°©ë²•ì„ ì œê³µí•©ë‹ˆë‹¤. ì´ ëª¨ë“ˆì„ ì‚¬ìš©í•˜ì—¬ 사용ìžê°€ 다양한 단축키 ìž‘ì—…ì„ í•  수 있ë„ë¡ ë‹¨ì¶•í‚¤ë¥¼ ì •ì˜ í•  수 있습니다. -참고로 ì„¤ì •ëœ ë‹¨ì¶•í‚¤ëŠ” 어플리케ì´ì…˜ì´ 백그ë¼ìš´ë“œë¡œ ìž‘ë™(ì°½ì´ í¬ì»¤ìŠ¤ ë˜ì§€ ì•ŠìŒ) í•  ë•Œë„ ì—¬ì „ížˆ ê³„ì† ìž‘ë™í•©ë‹ˆë‹¤. + +**참고:** 등ë¡ëœ 단축키는 어플리케ì´ì…˜ì´ 백그ë¼ìš´ë“œë¡œ ìž‘ë™(ì°½ì´ í¬ì»¤ìŠ¤ ë˜ì§€ ì•ŠìŒ) í•  ë•Œë„ ê³„ì†í•´ì„œ ìž‘ë™í•©ë‹ˆë‹¤. ì´ ëª¨ë“ˆì€ `app` ëª¨ë“ˆì˜ `ready` ì´ë²¤íŠ¸ ì´ì „ì— ì‚¬ìš©í•  수 없습니다. ```javascript @@ -30,25 +31,29 @@ app.on('will-quit', function() { }); ``` -## globalShortcut.register(accelerator, callback) +## Methods + +`global-shortcut` ëª¨ë“ˆì€ ë‹¤ìŒê³¼ ê°™ì€ ë©”ì„œë“œë¥¼ 가지고 있습니다: + +### `globalShortcut.register(accelerator, callback)` * `accelerator` [Accelerator](accelerator.md) * `callback` Function `accelerator`ë¡œ í‘œí˜„ëœ ì „ì—­ 단축키를 등ë¡í•©ë‹ˆë‹¤. 유저로부터 등ë¡ëœ 단축키가 ëˆŒë ¸ì„ ê²½ìš° `callback` 함수가 호출ë©ë‹ˆë‹¤. -## globalShortcut.isRegistered(accelerator) +### `globalShortcut.isRegistered(accelerator)` * `accelerator` [Accelerator](accelerator.md) ì§€ì •ëœ `accelerator` 단축키가 등ë¡ë˜ì—ˆëŠ”지 여부를 확ì¸í•©ë‹ˆë‹¤. ë°˜í™˜ê°’ì€ boolean(true, false) 입니다. -## globalShortcut.unregister(accelerator) +### `globalShortcut.unregister(accelerator)` * `accelerator` [Accelerator](accelerator.md) -`키코드`ì— í•´ë‹¹í•˜ëŠ” ì „ì—­ 단축키를 ë“±ë¡ í•´ì œí•©ë‹ˆë‹¤. +`accelerator`ì— í•´ë‹¹í•˜ëŠ” ì „ì—­ 단축키를 ë“±ë¡ í•´ì œí•©ë‹ˆë‹¤. -## globalShortcut.unregisterAll() +### `globalShortcut.unregisterAll()` 모든 ì „ì—­ 단축키 등ë¡ì„ 해제합니다. diff --git a/docs-translations/ko/api/ipc-main-process.md b/docs-translations/ko/api/ipc-main-process.md index 7f6a091de46d..496afd203318 100644 --- a/docs-translations/ko/api/ipc-main-process.md +++ b/docs-translations/ko/api/ipc-main-process.md @@ -1,17 +1,21 @@ # ipc (main process) -ëžœë”러 프로세스(웹 페ì´ì§€)ë¡œ 부터 ë™ê¸° ë˜ëŠ” 비ë™ê¸°ë¡œ 메시지를 받아 처리합니다. +`ipc` (main process) ëª¨ë“ˆì€ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ 사용할 ë•Œ ëžœë”러 프로세스(웹 페ì´ì§€)ì—ì„œ ì „ë‹¬ëœ ë™ê¸° ë˜ëŠ” 비ë™ê¸° 메시지를 ë³´ë‚´ê³  받는 ë°©ë²•ì„ ì œê³µí•©ë‹ˆë‹¤. +ëžœë”러 프로세스ì—ì„œ 메시지를 전달하면 ì´ ëª¨ë“ˆì„ í†µí•´ 메시지를 ë°›ì„ ìˆ˜ 있습니다. -ëžœë”러로부터 ë°œì‹ ëœ ë©”ì‹œì§€ë“¤ì€ ëª¨ë‘ ì´ ëª¨ë“ˆì—ì„œ `channel` ì´ë¼ëŠ” 특정 ì´ë²¤íŠ¸ ì´ë¦„ì„ í†µí•´ 수신할 수 있습니다. -ë™ê¸° 메시지는 `event.returnValue`를 ì´ìš©í•˜ì—¬ 반환값(답장)ì„ ì„¤ì •í•  수 있습니다. 비ë™ê¸° 메시지ë¼ë©´ `event.sender.send(...)`를 사용하면 ë©ë‹ˆë‹¤. +## 메시지 전송 -ë˜í•œ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ ëžœë”러 프로세스로 메시지를 보내는 ê²ƒë„ ê°€ëŠ¥í•©ë‹ˆë‹¤. -ìžì„¸í•œ ë‚´ìš©ì€ [WebContents.send](browser-window.md#webcontentssendchannel-args)를 참고 하세요. +물론 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ ëžœë”러 프로세스로 메시지를 보내는 ê²ƒë„ ê°€ëŠ¥í•©ë‹ˆë‹¤. +ìžì„¸í•œ ë‚´ìš©ì€ [WebContents.send](browser-window.md#webcontentssendchannel-args)를 참고하세요. -보내진 ë©”ì‹œì§€ë“¤ì„ ì²˜ë¦¬í•˜ëŠ” 예제입니다: +- 메시지를 전송할 ë•Œ ì´ë²¤íŠ¸ ì´ë¦„ì€ `channel`ì´ ë©ë‹ˆë‹¤. +- ë©”ì‹œì§€ì— ë™ê¸°ë¡œ ì‘답할 ë• ë°˜ë“œì‹œ `event.returnValue`를 설정해야 합니다. +- 메시지를 비ë™ê¸°ë¡œ ì‘답할 ë• `event.sender.send(...)` 메서드를 사용할 수 있습니다. + +ëžœë”러 프로세스와 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ê°„ì— ë©”ì‹œì§€ë¥¼ 전달하고 받는 예제입니다: ```javascript -// ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ 처리. +// ë©”ì¸ í”„ë¡œì„¸ìŠ¤ var ipc = require('ipc'); ipc.on('asynchronous-message', function(event, arg) { console.log(arg); // prints "ping" @@ -25,7 +29,7 @@ ipc.on('synchronous-message', function(event, arg) { ``` ```javascript -// ëžœë”러 프로세스ì—ì„œì˜ ì²˜ë¦¬ (web page). +// ëžœë”러 프로세스 (web page) var ipc = require('ipc'); console.log(ipc.sendSync('synchronous-message', 'ping')); // prints "pong" @@ -35,12 +39,33 @@ ipc.on('asynchronous-reply', function(arg) { ipc.send('asynchronous-message', 'ping'); ``` -## Class: Event +## 메시지 ë¦¬ìŠ¤ë‹ -### Event.returnValue +`ipc` ëª¨ë“ˆì€ ë‹¤ìŒê³¼ ê°™ì€ ì´ë²¤íŠ¸ 메서드를 가지고 있습니다: -ë™ê¸° 메시지를 설정합니다. +### `ipc.on(channel, callback)` -### Event.sender +* `channel` String - ì´ë²¤íŠ¸ ì´ë¦„ +* `callback` Function -메시지를 보내온 sender `WebContents` ê°ì²´ìž…니다. +ì´ë²¤íŠ¸ê°€ ë°œìƒí•˜ë©´ `callback`ì— `event` ê°ì²´ì™€ `arg` 메시지가 í¬í•¨ë˜ì–´ 호출ë©ë‹ˆë‹¤. + +## IPC Events + +`callback`ì—ì„œ ì „ë‹¬ëœ `event` ê°ì²´ëŠ” 다ìŒê³¼ ê°™ì€ ë©”ì„œë“œì™€ ì†ì„±ì„ 가지고 있습니다: + +### `Event.returnValue` + +ì´ ë©”ì‹œì§€ë¥¼ 지정하면 ë™ê¸° 메시지를 전달합니다. + +### `Event.sender` + +메시지를 보낸 `WebContents` ê°ì²´ë¥¼ 반환합니다. + +### `Event.sender.send(channel[, arg1][, arg2][, ...])` + +* `channel` String - The event name. +* `arg` (optional) + +ëžœë”러 프로세스로 비ë™ê¸° 메시지를 전달합니다. +옵션으로 `arg`ì— í•œ ê°œ ë˜ëŠ” 여러 ê°œì˜ ë©”ì‹œì§€ë¥¼ í¬í•¨í•  수 있습니다. 모든 íƒ€ìž…ì„ ì‚¬ìš©í•  수 있습니다. diff --git a/docs-translations/ko/api/ipc-renderer.md b/docs-translations/ko/api/ipc-renderer.md index b8bbb7ffa14d..67864c4e1157 100644 --- a/docs-translations/ko/api/ipc-renderer.md +++ b/docs-translations/ko/api/ipc-renderer.md @@ -1,25 +1,45 @@ # ipc (renderer) -`ipc` ëª¨ë“ˆì€ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 메시지를 ë™ê¸° ë˜ëŠ” 비ë™ê¸°ë¡œ ë³´ë‚´ê³  ë°›ì„ ìˆ˜ 있는 몇 가지 ë°©ë²•ì„ ì œê³µí•©ë‹ˆë‹¤. -만약 ëžœë”러 프로세스ì—ì„œ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì˜ ëª¨ë“ˆì„ ì§ì ‘ì ìœ¼ë¡œ 사용하고 싶다면 [remote](remote.md) ëª¨ë“ˆì„ ì‚¬ìš©í•˜ëŠ” ê²ƒì„ ê³ ë ¤í•´ë³´ëŠ” ê²ƒì´ ì¢‹ìŠµë‹ˆë‹¤. +`ipc` (renderer) ëª¨ë“ˆì€ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ ë™ê¸° ë˜ëŠ” 비ë™ê¸° 메시지를 ë³´ë‚´ê³  받는 ë°©ë²•ì„ ì œê³µí•©ë‹ˆë‹¤. +물론 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œë¶€í„° ë°›ì€ ë©”ì‹œì§€ì— ì‘답할 ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. -[ipc (main process)](ipc-main-process.md)ì—ì„œ 예제를 ë³¼ 수 있습니다. +**참고:** 만약 ëžœë”러 프로세스ì—ì„œ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì˜ ëª¨ë“ˆì„ ì§ì ‘ì  ì‚¬ìš©í•˜ê³  싶다면 [remote](remote.md) ëª¨ë“ˆì„ ì‚¬ìš©í•˜ëŠ” ê²ƒì„ ê³ ë ¤í•´ë³´ëŠ” ê²ƒì´ ì¢‹ìŠµë‹ˆë‹¤. -## ipc.send(channel[, args...]) +[ipc (main process)](ipc-main-process.md)ì—ì„œ 예제를 í™•ì¸ í•  수 있습니다. -지정한 `channel`ì„ í†µí•´ `args..`를 비ë™ê¸°ë¡œ 메시지를 보냅니다. ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” `ipc` ëª¨ë“ˆì˜ `channel` ì´ë²¤íŠ¸ë¥¼ 통해 메시지를 ë°›ì„ ìˆ˜ 있습니다. +## Methods -## ipc.sendSync(channel[, args...]) +`ipc` ëª¨ë“ˆì€ ë‹¤ìŒê³¼ ê°™ì€ ë©”ì„œë“œë¥¼ 가지고 있습니다: -지정한 `channel`ì„ í†µí•´ `args..`를 ë™ê¸°ë¡œ 메시지를 보냅니다. 그리고 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ 보낸 결과를 반환합니다. -ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” `ipc` ëª¨ë“ˆì˜ `channel` ì´ë²¤íŠ¸ë¥¼ 통해 메시지를 ë°›ì„ ìˆ˜ 있습니다. 그리고 `event.returnValue`를 통해 ë°˜í™˜ê°’ì„ ì„¤ì •í•  수 있습니다. +**참고:** ì´ ë©”ì†Œë“œë“¤ì„ ì‚¬ìš©í•˜ì—¬ `message`를 보낼 ë• ë°˜ë“œì‹œ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì˜ +[`ipc (main process)`](ipc-main-process.md) 모듈ì—ì„œë„ ì´ë²¤íŠ¸ 리스너를 등ë¡í•´ ë‘어야 합니다. -ì—­ìž ì£¼: `channel`ì€ ì´ë²¤íŠ¸ ì´ë¦„입니다. +### `ipc.send(channel[, arg1][, arg2][, ...])` -**알림:** 보통 개발ìžë“¤ì€ 해당 API를 사용하려 하지 않습니다. ë™ê¸° ipc ìž‘ì—…ì€ ëžœë”러 í”„ë¡œì„¸ìŠ¤ì˜ ëª¨ë“  ìž‘ì—…ì„ ì¤‘ë‹¨ì‹œí‚µë‹ˆë‹¤. +* `channel` String - ì´ë²¤íŠ¸ ì´ë¦„ +* `arg` (optional) -## ipc.sendToHost(channel[, args...]) +`channel`ì„ í†µí•´ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì— ë¹„ë™ê¸° 메시지를 보냅니다. +옵션으로 `arg`ì— í•œ ê°œ ë˜ëŠ” 여러 ê°œì˜ ë©”ì‹œì§€ë¥¼ í¬í•¨í•  수 있습니다. 모든 íƒ€ìž…ì„ ì‚¬ìš©í•  수 있습니다. +ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” `ipc`를 통해 `channel` ì´ë²¤íŠ¸ë¥¼ ë¦¬ìŠ¤ë‹ í•  수 있습니다. -`ipc.send`와 비슷하지만 메시지를 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ 대신 호스트 페ì´ì§€ë¡œ 보냅니다. +### `ipc.sendSync(channel[, arg1][, arg2][, ...])` -ì´ ë©”ì†Œë“œëŠ” 보통 ``와 호스트 페ì´ì§€ ê°„ì˜ í†µì‹ ì— ì‚¬ìš©ë©ë‹ˆë‹¤. +* `channel` String - ì´ë²¤íŠ¸ ì´ë¦„ +* `arg` (optional) + +`channel`ì„ í†µí•´ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì— ë™ê¸° 메시지를 보냅니다. +옵션으로 `arg`ì— í•œ ê°œ ë˜ëŠ” 여러 ê°œì˜ ë©”ì‹œì§€ë¥¼ í¬í•¨í•  수 있습니다. 모든 íƒ€ìž…ì„ ì‚¬ìš©í•  수 있습니다. +ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” `ipc`를 통해 `channel` ì´ë²¤íŠ¸ë¥¼ ë¦¬ìŠ¤ë‹ í•  수 있습니다. + +ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„  `ipc` ëª¨ë“ˆì˜ `channel` ì´ë²¤íŠ¸ë¥¼ 통해 ë°›ì€ `event.returnValue`ë¡œ 회신 í•  수 있습니다. + +**참고:** ë™ê¸° ë©”ì‹œì§•ì€ ëª¨ë“  ëžœë”러 í”„ë¡œì„¸ìŠ¤ì˜ ìž‘ì—…ì„ ì¼ì‹œ 중단시킵니다. ì´ ë©”ì„œë“œë¥¼ 사용하는 ê²ƒì„ ê¶Œìž¥í•˜ì§€ 않습니다. + +### `ipc.sendToHost(channel[, arg1][, arg2][, ...])` + +* `channel` String - ì´ë²¤íŠ¸ ì´ë¦„ +* `arg` (optional) + +`ipc.send`와 비슷하지만 ì´ë²¤íŠ¸ë¥¼ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ 대신 호스트 페ì´ì§€ë‚´ì˜ ``ë¡œ 보냅니다. +옵션으로 `arg`ì— í•œ ê°œ ë˜ëŠ” 여러 ê°œì˜ ë©”ì‹œì§€ë¥¼ í¬í•¨í•  수 있습니다. 모든 íƒ€ìž…ì„ ì‚¬ìš©í•  수 있습니다. diff --git a/docs-translations/ko/api/menu.md b/docs-translations/ko/api/menu.md index 62e26f13685b..6636158cdda5 100644 --- a/docs-translations/ko/api/menu.md +++ b/docs-translations/ko/api/menu.md @@ -183,7 +183,7 @@ Menu.setApplicationMenu(menu); `action`ì„ ì–´í”Œë¦¬ì¼€ì´ì…˜ì˜ first responderì— ì „ë‹¬í•©ë‹ˆë‹¤. ì´ ë©”ì„œë“œëŠ” Cocoa 메뉴 ë™ìž‘ì„ ì—뮬레ì´íŠ¸ í•˜ëŠ”ë° ì‚¬ìš©ë˜ë©° 보통 `MenuItem`ì˜ `selector` ì†ì„±ì— 사용ë©ë‹ˆë‹¤. -**알림:** ì´ ë©”ì„œë“œëŠ” OS Xì—서만 사용할 수 있습니다. +**참고:** ì´ ë©”ì„œë“œëŠ” OS Xì—서만 사용할 수 있습니다. ### Class Method: Menu.buildFromTemplate(template) diff --git a/docs-translations/ko/api/power-save-blocker.md b/docs-translations/ko/api/power-save-blocker.md index e686891a5ca5..03bb3bf2a245 100644 --- a/docs-translations/ko/api/power-save-blocker.md +++ b/docs-translations/ko/api/power-save-blocker.md @@ -23,7 +23,7 @@ powerSaveBlocker.stop(id); Power save blocker를 시작하고 ì‹œìŠ¤í…œì´ ì €ì „ë ¥ 모드(슬립)ë¡œ 진입하는 ê²ƒì„ ë§‰ìŠµë‹ˆë‹¤. 정수로 ëœ ì‹ë³„ ID를 반환합니다. -**알림:** +**참고:** `prevent-display-sleep` 모드는 `prevent-app-suspension` 보다 우선순위가 높습니다. 가장 ë†’ì€ ìš°ì„ ìˆœìœ„ì˜ ëª¨ë“œë§Œ ìž‘ë™í•©ë‹ˆë‹¤. 다시 ë§í•´ `prevent-display-sleep` 모드는 언제나 `prevent-app-suspension` ëª¨ë“œì˜ íš¨ê³¼ë¥¼ ë®ì–´ì”Œì›ë‹ˆë‹¤. diff --git a/docs-translations/ko/api/process.md b/docs-translations/ko/api/process.md index b5f98266b8b3..09b57d1b869b 100644 --- a/docs-translations/ko/api/process.md +++ b/docs-translations/ko/api/process.md @@ -10,3 +10,9 @@ Electronì˜ `process` ê°ì²´ëŠ” ê¸°ì¡´ì˜ node와는 달리 ì•½ê°„ì˜ ì°¨ì´ì  ## process.hang 현재 í”„ë¡œì„¸ìŠ¤ì˜ ì£¼ 스레드를 중단시킵니다. + +## process.setFdLimit(maxDescriptors) _OS X_ _Linux_ + +* `maxDescriptors` Integer + +`maxDescriptors`ì— file descriptor 소프트 리미트를 설정하거나 OS 하드 리미트를 설정합니다. ê°’ì€ í˜„ìž¬ í”„ë¡œì„¸ìŠ¤ì— ëŒ€í•´ ë‚®ì€ ê°’ì´ì–´ì•¼ 합니다. diff --git a/docs-translations/ko/api/protocol.md b/docs-translations/ko/api/protocol.md index 45cd69eea63b..0a1c04b6dcd6 100644 --- a/docs-translations/ko/api/protocol.md +++ b/docs-translations/ko/api/protocol.md @@ -20,7 +20,7 @@ app.on('ready', function() { }); ``` -**알림:** ì´ ëª¨ë“ˆì€ `ready` ì´ë²¤íŠ¸ê°€ í˜¸ì¶œëœ ì´í›„ì—만 사용할 수 있습니다. +**참고:** ì´ ëª¨ë“ˆì€ `ready` ì´ë²¤íŠ¸ê°€ í˜¸ì¶œëœ ì´í›„ì—만 사용할 수 있습니다. ## protocol.registerStandardSchemes(schemes) diff --git a/docs-translations/ko/api/remote.md b/docs-translations/ko/api/remote.md index 8700ba21c57f..d5ee74cfb1e8 100644 --- a/docs-translations/ko/api/remote.md +++ b/docs-translations/ko/api/remote.md @@ -16,7 +16,7 @@ var win = new BrowserWindow({ width: 800, height: 600 }); win.loadUrl('https://github.com'); ``` -알림: 반대로 하려면(ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ ëžœë”러 í”„ë¡œì„¸ìŠ¤ì— ì ‘ê·¼) [webContents.executeJavascript](browser-window.md#webcontents-executejavascript-code) API를 사용하면 ë©ë‹ˆë‹¤. +**참고:** 반대로 하려면(ë©”ì¸ í”„ë¡œì„¸ìŠ¤ì—ì„œ ëžœë”러 í”„ë¡œì„¸ìŠ¤ì— ì ‘ê·¼) [webContents.executeJavascript](browser-window.md#webcontents-executejavascript-code) API를 사용하면 ë©ë‹ˆë‹¤. ## Remote ê°ì²´ diff --git a/docs-translations/ko/api/tray.md b/docs-translations/ko/api/tray.md index 05decef5a48f..8ee015f98c37 100644 --- a/docs-translations/ko/api/tray.md +++ b/docs-translations/ko/api/tray.md @@ -169,7 +169,7 @@ __주ì˜:__ ì´ ê¸°ëŠ¥ì€ OS Xì—서만 ìž‘ë™í•©ë‹ˆë‹¤. 트레ì´ì— 알림í’ì„ ì„ ìƒì„±í•©ë‹ˆë‹¤. -__알림:__ ì´ ê¸°ëŠ¥ì€ Windowsì—서만 ìž‘ë™í•©ë‹ˆë‹¤. +__주ì˜:__ ì´ ê¸°ëŠ¥ì€ Windowsì—서만 ìž‘ë™í•©ë‹ˆë‹¤. ### Tray.popContextMenu([position]) diff --git a/docs-translations/ko/api/window-open.md b/docs-translations/ko/api/window-open.md index 706d7e090bb8..6d7c0b9fabbe 100644 --- a/docs-translations/ko/api/window-open.md +++ b/docs-translations/ko/api/window-open.md @@ -19,7 +19,7 @@ * `message` String * `targetOrigin` String -부모 윈ë„ìš°ì— ë©”ì‹œì§€ë¥¼ 보냅니다. 특정한 originì„ ì§€ì •í•  ìˆ˜ë„ ìžˆìœ¼ë©° `*`를 지정하면 ë”°ë¡œ origin ì„¤ì •ì„ ì‚¬ìš©í•˜ì§€ 않습니다. +부모 윈ë„ìš°ì— ë©”ì‹œì§€ë¥¼ 보냅니다. originì„ íŠ¹ì •í•  수 있으며 `*`를 지정하면 ë”°ë¡œ origin ì„¤ì •ì„ ì‚¬ìš©í•˜ì§€ 않습니다. ## Class: BrowserWindowProxy @@ -52,6 +52,6 @@ Forcefully closes the child window without calling its unload event. * `message` String * `targetOrigin` String -ìžì‹ 윈ë„ìš°ì— ë©”ì‹œì§€ë¥¼ 보냅니다. 특정한 originì„ ì§€ì •í•  ìˆ˜ë„ ìžˆìœ¼ë©° `*`를 지정하면 ë”°ë¡œ origin ì„¤ì •ì„ ì‚¬ìš©í•˜ì§€ 않습니다. +ìžì‹ 윈ë„ìš°ì— ë©”ì‹œì§€ë¥¼ 보냅니다. originì„ íŠ¹ì •í•  수 있으며 `*`를 지정하면 ë”°ë¡œ origin ì„¤ì •ì„ ì‚¬ìš©í•˜ì§€ 않습니다. 참고로 ìžì‹ 윈ë„ìš°ì˜ `window.opener` ê°ì²´ì—는 다른 ì†ì„± ì—†ì´ ì´ ë©”ì„œë“œ í•œ 개만 구현ë˜ì–´ 있습니다. diff --git a/docs-translations/ko/development/atom-shell-vs-node-webkit.md b/docs-translations/ko/development/atom-shell-vs-node-webkit.md index f688204d537d..aa0d3e19058f 100644 --- a/docs-translations/ko/development/atom-shell-vs-node-webkit.md +++ b/docs-translations/ko/development/atom-shell-vs-node-webkit.md @@ -1,6 +1,6 @@ # NW.js와 기술ì ìœ¼ë¡œ ë‹¤ë¥¸ì  (ì´ì „ node-webkit) -__알림: Electronì€ ì´ì „까지 Atom Shellë¡œ 불려졌습니다.__ +__주ì˜: Electronì€ Atom Shellì˜ ìƒˆë¡œìš´ ì´ë¦„입니다.__ NW.js 처럼 Electronì€ JavaScript와 HTML 그리고 Node í†µí•©í™˜ê²½ì„ ì œê³µí•¨ìœ¼ë¡œì¨ ì›¹ 페ì´ì§€ì—ì„œ 저수준 ì‹œìŠ¤í…œì— ì ‘ê·¼í•  수 있는 웹 기반 ë°ìŠ¤í¬íƒ‘ 어플리케ì´ì…˜ì„ 작성할 수 있ë„ë¡ í•©ë‹ˆë‹¤. diff --git a/docs-translations/ko/development/build-instructions-linux.md b/docs-translations/ko/development/build-instructions-linux.md index 285b933dd921..adcdab8357ea 100644 --- a/docs-translations/ko/development/build-instructions-linux.md +++ b/docs-translations/ko/development/build-instructions-linux.md @@ -4,7 +4,7 @@ * Python 2.7.x. 몇몇 CentOS와 ê°™ì€ ë°°í¬íŒë“¤ì€ ì•„ì§ë„ Python 2.6.x ë²„ì „ì„ ì‚¬ìš©í•©ë‹ˆë‹¤. 그래서 `python -V`를 통해 ë²„ì „ì„ í™•ì¸í•´ 줄 필요가 있습니다. * Node.js v0.12.x. Node를 설치하는 ë°©ë²•ì€ ì—¬ëŸ¬ê°€ì§€ê°€ 있습니다. 그중 하나는 [Node.js](http://nodejs.org) 사ì´íŠ¸ì—ì„œ 소스코드를 받아 빌드하는 방법입니다. -ì´ë ‡ê²Œ 하면 Node를 ì¼ë°˜ 유저로 홈 ë””ë ‰í„°ë¦¬ì— ì„¤ì¹˜í•  수 있습니다. ë˜ëŠ” [NodeSource](https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories) ì—ì„œ 받아올 ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +ì´ë ‡ê²Œ 하면 Node를 ì¼ë°˜ 유저로 홈 ë””ë ‰í„°ë¦¬ì— ì„¤ì¹˜í•  수 있습니다. ë˜ëŠ” [NodeSource](https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories)ì—ì„œ 소스 파ì¼ì„ 받아올 수 있습니다. ìžì„¸í•œ ë‚´ìš©ì€ [Node.js 설치 방법](https://github.com/joyent/node/wiki/Installation) ì„ ì°¸ê³ í•˜ì„¸ìš”. * Clang 3.4 ë˜ëŠ” 최신 버전 * GTK+ 와 libnotifyì˜ ê°œë°œìš© í—¤ë” @@ -78,7 +78,7 @@ $ ./script/create-dist.py ì´ ìŠ¤í¬ë¦½íŠ¸ëŠ” 매우 ìž‘ì€ ë°°í¬íŒì„ `dist` ë””ë ‰í„°ë¦¬ì— ìƒì„±í•©ë‹ˆë‹¤. create-dist.py 스í¬ë¦½íŠ¸ë¥¼ 실행한 ì´í›„ 1.3GB를 초과하는 ê³µê°„ì„ ì°¨ì§€í•˜ëŠ” out/R í´ë”ì˜ ì‹¤í–‰íŒŒì¼ ë°”ì´ë„ˆë¦¬ëŠ” ì‚­ì œí•´ë„ ë©ë‹ˆë‹¤. -`Debug` 타겟만 빌드 í•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤: +ë˜ëŠ” `Debug` 타겟만 빌드 í•  수 있습니다: ```bash $ ./script/build.py -c D diff --git a/docs-translations/ko/development/build-instructions-mac.md b/docs-translations/ko/development/build-instructions-mac.md index ffab481c5c7c..eeed5a4df4ec 100644 --- a/docs-translations/ko/development/build-instructions-mac.md +++ b/docs-translations/ko/development/build-instructions-mac.md @@ -34,7 +34,7 @@ $ ./script/bootstrap.py -v $ ./script/build.py ``` -`Debug` 타겟만 빌드 í•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤: +ë˜ëŠ” `Debug` 타겟만 빌드 í•  수 있습니다: ```bash $ ./script/build.py -c D diff --git a/docs-translations/ko/development/build-instructions-windows.md b/docs-translations/ko/development/build-instructions-windows.md index df829de319d5..22734b1ec236 100644 --- a/docs-translations/ko/development/build-instructions-windows.md +++ b/docs-translations/ko/development/build-instructions-windows.md @@ -9,7 +9,7 @@ * [git](http://git-scm.com) 현재 Windows를 설치하지 않았다면 [modern.ie](https://www.modern.ie/en-us/virtualization-tools#downloads)ì—ì„œ -ì‚¬ìš©ê¸°í•œì´ ì •í•´ì ¸ìžˆëŠ” 무료 ê°€ìƒë¨¸ì‹  ë²„ì „ì˜ Windows를 받아 Electronì„ ë¹Œë“œí•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +사용 ê¸°í•œì´ ì •í•´ì ¸ìžˆëŠ” 무료 ê°€ìƒë¨¸ì‹  ë²„ì „ì˜ Windows를 받아 Electronì„ ë¹Œë“œí•˜ëŠ” ë°©ë²•ë„ ìžˆìŠµë‹ˆë‹¤. Electronì€ ì „ì ìœ¼ë¡œ command-line 스í¬ë¦½íŠ¸ë¥¼ 사용하여 빌드합니다. ê·¸ë ‡ê¸°ì— Electronì„ ê°œë°œí•˜ëŠ”ë° ì•„ë¬´ëŸ° ì—디터나 사용할 수 있습니다. 하지만 ì´ ë§ì€ Visual Studio를 ê°œë°œì„ ìœ„í•´ 사용할 수 없다는 ë§ì´ ë©ë‹ˆë‹¤. ë‚˜ì¤‘ì— Visual Studio를 ì´ìš©í•œ 빌드 ë°©ë²•ë„ ì œê³µí•  예정입니다. @@ -40,7 +40,7 @@ python script\bootstrap.py -v python script\build.py ``` -`Debug` 타겟만 빌드 í•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤: +ë˜ëŠ” `Debug` 타겟만 빌드 í•  수 있습니다: ```powershell python script\build.py -c D diff --git a/docs-translations/ko/styleguide.md b/docs-translations/ko/styleguide.md index 1916f80c68ef..1168556a3d7b 100644 --- a/docs-translations/ko/styleguide.md +++ b/docs-translations/ko/styleguide.md @@ -41,7 +41,7 @@ Electron 문서 구조를 ì´í•´í•˜ëŠ” ë° ì°¸ê³ í•  수 있는 유용한 ë„움 --- 메서드 ì´ë¦„ì€ ì¸ìˆ˜ê°€ ë¬´ì—‡ì„ ë°›ëŠ”ì§€ì— ë”°ë¼ ê²°ì •ë©ë‹ˆë‹¤. ì„ íƒì  ì¸ìˆ˜ëŠ” 브ë¼ì¼“([, ])으로 묶어 -ì´ ì¸ìˆ˜ê°€ 다른 ì¸ìˆ˜ë’¤ì— ì„ íƒì ìœ¼ë¡œ 사용할 수 있다는 ê²ƒì„ ì„¤ëª…í•©ë‹ˆë‹¤. +ì´ ì¸ìˆ˜ê°€ 다른 ì¸ìˆ˜ë’¤ì—ì„œ ì„ íƒì ìœ¼ë¡œ ì‚¬ìš©ë  ìˆ˜ 있다는 ê²ƒì„ í‘œì‹œí•©ë‹ˆë‹¤. ë©”ì„œë“œì˜ ë°‘ì—ì„  ê° ì¸ìˆ˜ì— 대해 ìžì„¸í•œ ì„¤ëª…ì„ í•©ë‹ˆë‹¤. ì¸ìˆ˜ì˜ íƒ€ìž…ì€ ì¼ë°˜ì ì¸ 타입 중 하나를 받거나: [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object), [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) diff --git a/docs-translations/ko/tutorial/application-packaging.md b/docs-translations/ko/tutorial/application-packaging.md index 4c799d71da4f..0f8169089516 100644 --- a/docs-translations/ko/tutorial/application-packaging.md +++ b/docs-translations/ko/tutorial/application-packaging.md @@ -134,7 +134,7 @@ originalFs.readFileSync('/path/to/example.asar'); ## `asar` ì•„ì¹´ì´ë¸Œì— 미리 압축 í•´ì œëœ íŒŒì¼ ì¶”ê°€í•˜ê¸° 전술한 바와 ê°™ì´ ëª‡ëª‡ Node API는 호출 ì‹œ 해당 파ì¼ì„ ìž„ì‹œí´ë”ì— ì••ì¶•ì„ í•´ì œí•©ë‹ˆë‹¤. -ë”°ë¡œ 성능문제가 ë°œìƒí•  수 있습니다. 그리고 백신 ì†Œí”„íŠ¸ì›¨ì–´ì˜ ìž˜ëª»ëœ ì˜¤ì§„ì„ ì¼ìœ¼í‚¬ ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +ì´ ë°©ë²•ì€ ì„±ëŠ¥ë¬¸ì œê°€ ë°œìƒí•  수 있습니다. 그리고 ì„¤ê³„ìƒ ë°±ì‹  소프트웨어ì—ì„œ 잘못 진단하여 ë°”ì´ëŸ¬ìŠ¤ë¡œ íŒë‹¨ í•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. ì´ ë¬¸ì œë¥¼ 해결하려면 `--unpack` ì˜µì…˜ì„ í™œìš©í•˜ì—¬ 파ì¼ì„ ì••ì¶•ì´ í’€ë ¤ì§„ ìƒíƒœë¡œ 유지해야 합니다. 다ìŒì˜ 예제는 node 네ì´í‹°ë¸Œ ëª¨ë“ˆì˜ ê³µìœ  ë¼ì´ë¸ŒëŸ¬ë¦¬ë¥¼ unpack ìƒíƒœë¡œ 유지합니다: diff --git a/docs-translations/ko/tutorial/debugging-main-process.md b/docs-translations/ko/tutorial/debugging-main-process.md index f396071cdd12..dcaf6bc9bf36 100644 --- a/docs-translations/ko/tutorial/debugging-main-process.md +++ b/docs-translations/ko/tutorial/debugging-main-process.md @@ -26,13 +26,13 @@ $ node-inspector ### 2. Electronìš© 디버그 모드 활성화 -다ìŒê³¼ ê°™ì´ debung 플래그로 Electronì„ ì‹¤í–‰í•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤: +다ìŒê³¼ ê°™ì´ debung 플래그로 Electronì„ ì‹¤í–‰í•  수 있습니다: ```bash $ electron --debug=5858 your/app ``` -ë˜ëŠ” 스í¬ë¦½íŠ¸ 첫번째 ë¼ì¸ì—ì„œ ì¼ì‹œì •ì§€: +ë˜ëŠ” 스í¬ë¦½íŠ¸ 첫번째 ë¼ì¸ì—ì„œ ì¼ì‹œ 정지할 수 있습니다: ```bash $ electron --debug-brk=5858 your/app diff --git a/docs-translations/ko/tutorial/online-offline-events.md b/docs-translations/ko/tutorial/online-offline-events.md index 6a2e88fb3e43..3ccf20c7d568 100644 --- a/docs-translations/ko/tutorial/online-offline-events.md +++ b/docs-translations/ko/tutorial/online-offline-events.md @@ -35,10 +35,10 @@ _online-status.html_ ``` -필요한 경우 ì´ ì´ë²¤íŠ¸ë¥¼ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 보낼 ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. -ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” `navigator` 오브ì íŠ¸ë¥¼ 가지고 있지 않기 ë•Œë¬¸ì— ì´ ì´ë²¤íŠ¸ë¥¼ ì§ì ‘ 사용할 수 없습니다. -ì´ëŠ” ë‹¤ìŒ ì˜ˆì œì™€ ê°™ì´ electronì˜ inter-process communication(ipc)유틸리티를 사용하여 -ì´ë²¤íŠ¸ë¥¼ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 전달하는 것으로 í•´ê²°í•  수 있습니다. +물론 필요하다면 ì´ ì´ë²¤íŠ¸ë¥¼ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 보낼 ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +하지만 ë©”ì¸ í”„ë¡œì„¸ìŠ¤ëŠ” `navigator` ê°ì²´ë¥¼ 가지고 있지 않기 ë•Œë¬¸ì— ì´ ì´ë²¤íŠ¸ë¥¼ ì§ì ‘ 사용할 수 없습니다. + +대신 ë‹¤ìŒ ì˜ˆì œì™€ ê°™ì´ Electronì˜ inter-process communication(ipc) 유틸리티를 사용하면 ì´ë²¤íŠ¸ë¥¼ ë©”ì¸ í”„ë¡œì„¸ìŠ¤ë¡œ 전달할 수 있습니다. _main.js_ diff --git a/docs-translations/ko/tutorial/quick-start.md b/docs-translations/ko/tutorial/quick-start.md index 39d9edfdbfb4..37b48d993342 100644 --- a/docs-translations/ko/tutorial/quick-start.md +++ b/docs-translations/ko/tutorial/quick-start.md @@ -125,7 +125,7 @@ app.on('ready', function() { ## 앱 실행하기 ì•±ì„ ìž‘ì„±í•œ 후 [어플리케ì´ì…˜ ë°°í¬](application-distribution.md) ê°€ì´ë“œë¥¼ ë”°ë¼ ì•±ì„ íŒ¨í‚¤ì§• 하고 패키징한 ì•±ì„ ì‹¤í–‰í•  수 있습니다. -ë˜ëŠ” Electron 실행파ì¼ì„ 다운로드 받아 바로 실행해 ë³¼ ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +ë˜í•œ Electron 실행파ì¼ì„ 다운로드 받아 바로 실행해 ë³¼ ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. ### electron-prebuilt diff --git a/docs-translations/ko/tutorial/using-native-node-modules.md b/docs-translations/ko/tutorial/using-native-node-modules.md index 5b8f71210550..4584ebd460fe 100644 --- a/docs-translations/ko/tutorial/using-native-node-modules.md +++ b/docs-translations/ko/tutorial/using-native-node-modules.md @@ -40,7 +40,7 @@ $ HOME=~/.electron-gyp node-gyp rebuild --target=0.29.1 --arch=x64 --dist-url=ht ### npmì„ ì´ìš©í•œ 방법 -ë˜í•œ `npm`ì„ ì‚¬ìš©í•˜ì—¬ ëª¨ë“ˆì„ ì„¤ì¹˜í•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +ë˜í•œ `npm`ì„ í†µí•´ 설치할 ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. 환경변수가 필요한 ê²ƒì„ ì œì™¸í•˜ê³  ì¼ë°˜ Node ëª¨ë“ˆì„ ì„¤ì¹˜í•˜ëŠ” 방법과 완전히 똑같습니다: ```bash diff --git a/docs-translations/ko/tutorial/using-pepper-flash-plugin.md b/docs-translations/ko/tutorial/using-pepper-flash-plugin.md index 4a471c2464e2..4577bc296fea 100644 --- a/docs-translations/ko/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/ko/tutorial/using-pepper-flash-plugin.md @@ -1,6 +1,7 @@ # Pepper 플래시 í”ŒëŸ¬ê·¸ì¸ ì‚¬ìš©í•˜ê¸° -필요하다면 Pepper 플래시 플러그ì¸ì„ 사용할 수 있습니다. Electronì—ì„œ pepper 플래시 플러그ì¸ì„ 사용하기 위해선 ë”°ë¡œ pepper 플래시 플러그ì¸ì˜ 위치를 지정해 주어야합니다. +ìž‘ì—…ì— í•„ìš”í•œ 경우 pepper 플래시 플러그ì¸ì„ 사용할 수 있습니다. +Electronì—ì„œ pepper 플래시 플러그ì¸ì„ 사용하기 위해선 ë”°ë¡œ pepper 플래시 플러그ì¸ì˜ 위치를 지정해 주어야합니다. ## 플래시 í”ŒëŸ¬ê·¸ì¸ ì¤€ë¹„í•˜ê¸° From 50bfe9e335279491706c5c4ab13e53bc9c0bcdae Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 1 Sep 2015 11:29:39 +0800 Subject: [PATCH 41/59] Set source and origin correctly for window.opener.postMessage --- atom/browser/lib/guest-window-manager.coffee | 14 ++++++++++---- atom/renderer/lib/override.coffee | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/atom/browser/lib/guest-window-manager.coffee b/atom/browser/lib/guest-window-manager.coffee index f92c1a46c051..861b0d10aa31 100644 --- a/atom/browser/lib/guest-window-manager.coffee +++ b/atom/browser/lib/guest-window-manager.coffee @@ -57,13 +57,19 @@ ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', (event, guestId, me if guestContents?.getUrl().indexOf(targetOrigin) is 0 or targetOrigin is '*' guestContents.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', message, targetOrigin -ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', (event, message, targetOrigin) -> +ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', (event, guestId, message, targetOrigin, sourceOrigin) -> embedder = v8Util.getHiddenValue event.sender, 'embedder' if embedder?.getUrl().indexOf(targetOrigin) is 0 or targetOrigin is '*' - embedder.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', message, targetOrigin + embedder.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', guestId, message, sourceOrigin ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', (event, guestId, method, args...) -> BrowserWindow.fromId(guestId)?.webContents?[method] args... -ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_IS_GUEST_WINDOW', (event) -> - event.returnValue = v8Util.getHiddenValue(event.sender, 'embedder') isnt undefined +ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_GET_GUEST_ID', (event) -> + embedder = v8Util.getHiddenValue event.sender, 'embedder' + if embedder? + guest = BrowserWindow.fromWebContents event.sender + if guest? + event.returnValue = guest.id + return + event.returnValue = null diff --git a/atom/renderer/lib/override.coffee b/atom/renderer/lib/override.coffee index a413178442f2..b60374e04754 100644 --- a/atom/renderer/lib/override.coffee +++ b/atom/renderer/lib/override.coffee @@ -94,14 +94,22 @@ window.confirm = (message, title='') -> window.prompt = -> throw new Error('prompt() is and will not be supported.') -# Simple implementation of postMessage. -if ipc.sendSync 'ATOM_SHELL_GUEST_WINDOW_MANAGER_IS_GUEST_WINDOW' +# Implement window.postMessage if current window is a guest window. +guestId = ipc.sendSync 'ATOM_SHELL_GUEST_WINDOW_MANAGER_GET_GUEST_ID' +if guestId? window.opener = postMessage: (message, targetOrigin='*') -> - ipc.send 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', message, targetOrigin + ipc.send 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', guestId, message, targetOrigin, location.origin -ipc.on 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', (message, targetOrigin) -> - window.postMessage message, targetOrigin +ipc.on 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', (guestId, message, sourceOrigin) -> + # Manually dispatch event instead of using postMessage because we also need to + # set event.source. + event = document.createEvent 'Event' + event.initEvent 'message', false, false + event.data = message + event.origin = sourceOrigin + event.source = new BrowserWindowProxy(guestId) + window.dispatchEvent event # Forward history operations to browser. sendHistoryOperation = (args...) -> From dddb5988182a6c9c065b8895b078c209d46f0eef Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 1 Sep 2015 11:51:28 +0800 Subject: [PATCH 42/59] spec: Node integration should work after POST --- spec/fixtures/pages/post.html | 10 ++++++++++ spec/webview-spec.coffee | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 spec/fixtures/pages/post.html diff --git a/spec/fixtures/pages/post.html b/spec/fixtures/pages/post.html new file mode 100644 index 000000000000..06f6f365492d --- /dev/null +++ b/spec/fixtures/pages/post.html @@ -0,0 +1,10 @@ + + +
+

+
+ + + diff --git a/spec/webview-spec.coffee b/spec/webview-spec.coffee index 7c2cd1a92adc..6eb391ac9483 100644 --- a/spec/webview-spec.coffee +++ b/spec/webview-spec.coffee @@ -48,6 +48,14 @@ describe ' tag', -> webview.src = "file://#{fixtures}/pages/d.html" document.body.appendChild webview + it 'loads node symbols after POST navigation when set', (done) -> + webview.addEventListener 'console-message', (e) -> + assert.equal e.message, 'function object object' + done() + webview.setAttribute 'nodeintegration', 'on' + webview.src = "file://#{fixtures}/pages/post.html" + document.body.appendChild webview + # If the test is executed with the debug build on Windows, we will skip it # because native modules don't work with the debug build (see issue #2558). if process.platform isnt 'win32' or From c70513f7ce2f3773d869ea53bd3c547ce8c34067 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 1 Sep 2015 12:15:00 +0800 Subject: [PATCH 43/59] spec: window.opener.postMessage should set source and origin --- spec/chromium-spec.coffee | 9 +++++++++ spec/fixtures/pages/window-opener-postMessage.html | 7 +++++++ 2 files changed, 16 insertions(+) create mode 100644 spec/fixtures/pages/window-opener-postMessage.html diff --git a/spec/chromium-spec.coffee b/spec/chromium-spec.coffee index f98c8a75c742..c594a97f3b83 100644 --- a/spec/chromium-spec.coffee +++ b/spec/chromium-spec.coffee @@ -63,6 +63,15 @@ describe 'chromium feature', -> b.close() done(if opener isnt null then undefined else opener) + describe 'window.opener.postMessage', -> + it 'sets source and origin correctly', (done) -> + b = window.open "file://#{fixtures}/pages/window-opener-postMessage.html", 'test', 'show=no' + window.addEventListener 'message', (event) -> + b.close() + assert.equal event.source.guestId, b.guestId + assert.equal event.origin, 'file://' + done() + describe 'creating a Uint8Array under browser side', -> it 'does not crash', -> RUint8Array = remote.getGlobal 'Uint8Array' diff --git a/spec/fixtures/pages/window-opener-postMessage.html b/spec/fixtures/pages/window-opener-postMessage.html new file mode 100644 index 000000000000..5d0f8ede6d37 --- /dev/null +++ b/spec/fixtures/pages/window-opener-postMessage.html @@ -0,0 +1,7 @@ + + + + + From 10b53f7f731e984a505dee7fdc1d9cc2a65b060f Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 1 Sep 2015 17:48:43 +0800 Subject: [PATCH 44/59] Fix print spooler hangs when printing more than 3 pages on Windows. --- .../chrome/browser/printing/print_job.cc | 120 +++++++++--------- 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/chromium_src/chrome/browser/printing/print_job.cc b/chromium_src/chrome/browser/printing/print_job.cc index 6bcc58322124..65449ef121e3 100644 --- a/chromium_src/chrome/browser/printing/print_job.cc +++ b/chromium_src/chrome/browser/printing/print_job.cc @@ -220,64 +220,6 @@ PrintedDocument* PrintJob::document() const { return document_.get(); } -void PrintJob::UpdatePrintedDocument(PrintedDocument* new_document) { - if (document_.get() == new_document) - return; - - document_ = new_document; - - if (document_.get()) { - settings_ = document_->settings(); - } - - if (worker_) { - DCHECK(!is_job_pending_); - // Sync the document with the worker. - worker_->PostTask(FROM_HERE, - base::Bind(&HoldRefCallback, - make_scoped_refptr(this), - base::Bind(&PrintJobWorker::OnDocumentChanged, - base::Unretained(worker_.get()), - document_))); - } -} - -void PrintJob::OnNotifyPrintJobEvent(const JobEventDetails& event_details) { - switch (event_details.type()) { - case JobEventDetails::FAILED: { - settings_.Clear(); - // No need to cancel since the worker already canceled itself. - Stop(); - break; - } - case JobEventDetails::USER_INIT_DONE: - case JobEventDetails::DEFAULT_INIT_DONE: - case JobEventDetails::USER_INIT_CANCELED: { - DCHECK_EQ(event_details.document(), document_.get()); - break; - } - case JobEventDetails::NEW_DOC: - case JobEventDetails::NEW_PAGE: - case JobEventDetails::JOB_DONE: - case JobEventDetails::ALL_PAGES_REQUESTED: { - // Don't care. - break; - } - case JobEventDetails::DOC_DONE: { - // This will call Stop() and broadcast a JOB_DONE message. - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&PrintJob::OnDocumentDone, this)); - break; - } - case JobEventDetails::PAGE_DONE: - break; - default: { - NOTREACHED(); - break; - } - } -} - #if defined(OS_WIN) class PrintJob::PdfToEmfState { @@ -375,6 +317,68 @@ void PrintJob::OnPdfToEmfPageConverted(int page_number, #endif // OS_WIN +void PrintJob::UpdatePrintedDocument(PrintedDocument* new_document) { + if (document_.get() == new_document) + return; + + document_ = new_document; + + if (document_.get()) { + settings_ = document_->settings(); + } + + if (worker_) { + DCHECK(!is_job_pending_); + // Sync the document with the worker. + worker_->PostTask(FROM_HERE, + base::Bind(&HoldRefCallback, + make_scoped_refptr(this), + base::Bind(&PrintJobWorker::OnDocumentChanged, + base::Unretained(worker_.get()), + document_))); + } +} + +void PrintJob::OnNotifyPrintJobEvent(const JobEventDetails& event_details) { + switch (event_details.type()) { + case JobEventDetails::FAILED: { + settings_.Clear(); + // No need to cancel since the worker already canceled itself. + Stop(); + break; + } + case JobEventDetails::USER_INIT_DONE: + case JobEventDetails::DEFAULT_INIT_DONE: + case JobEventDetails::USER_INIT_CANCELED: { + DCHECK_EQ(event_details.document(), document_.get()); + break; + } + case JobEventDetails::NEW_DOC: + case JobEventDetails::NEW_PAGE: + case JobEventDetails::JOB_DONE: + case JobEventDetails::ALL_PAGES_REQUESTED: { + // Don't care. + break; + } + case JobEventDetails::DOC_DONE: { + // This will call Stop() and broadcast a JOB_DONE message. + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(&PrintJob::OnDocumentDone, this)); + break; + } + case JobEventDetails::PAGE_DONE: +#if defined(OS_WIN) + ptd_to_emf_state_->OnPageProcessed( + base::Bind(&PrintJob::OnPdfToEmfPageConverted, this)); +#endif // OS_WIN + break; + default: { + NOTREACHED(); + break; + } + } +} + void PrintJob::OnDocumentDone() { // Be sure to live long enough. The instance could be destroyed by the // JOB_DONE broadcast. From 4062ca5f683bb9a12d9d2ec6209cdff259c059a5 Mon Sep 17 00:00:00 2001 From: Robo Date: Tue, 1 Sep 2015 15:32:14 +0530 Subject: [PATCH 45/59] implement wrapSession --- atom/browser/api/atom_api_session.cc | 42 +++++++++++++++++++++++----- atom/browser/api/lib/app.coffee | 15 +++++++--- atom/common/node_bindings.cc | 1 + docs/api/app.md | 32 --------------------- docs/api/session.md | 24 ++++++++++++++++ 5 files changed, 71 insertions(+), 43 deletions(-) diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 0b7640e416b5..3ca15ab871fa 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -106,12 +106,12 @@ template<> struct Converter { static v8::Local ToV8(v8::Isolate* isolate, content::DownloadItem* val) { - return mate::ObjectTemplateBuilder(isolate) - .SetValue("url", val->GetURL()) - .SetValue("filename", val->GetSuggestedFilename()) - .SetValue("mimeType", val->GetMimeType()) - .SetValue("hasUserGesture", val->HasUserGesture()) - .Build()->NewInstance(); + mate::Dictionary dict(isolate, v8::Object::New(isolate)); + dict.Set("url", val->GetURL()); + dict.Set("filename", val->GetSuggestedFilename()); + dict.Set("mimeType", val->GetMimeType()); + dict.Set("hasUserGesture", val->HasUserGesture()); + return dict.GetHandle(); } }; @@ -123,6 +123,10 @@ namespace api { namespace { +// The wrapSession funtion which is implemented in JavaScript +using WrapSessionCallback = base::Callback)>; +WrapSessionCallback g_wrap_session; + class ResolveProxyHelper { public: ResolveProxyHelper(AtomBrowserContext* browser_context, @@ -321,9 +325,33 @@ mate::Handle Session::CreateFrom( if (existing) return mate::CreateHandle(isolate, static_cast(existing)); - return mate::CreateHandle(isolate, new Session(browser_context)); + auto handle = mate::CreateHandle(isolate, new Session(browser_context)); + g_wrap_session.Run(handle.ToV8()); + return handle; +} + +void SetWrapSession(const WrapSessionCallback& callback) { + g_wrap_session = callback; +} + +void ClearWrapSession() { + g_wrap_session.Reset(); } } // namespace api } // namespace atom + +namespace { + +void Initialize(v8::Local exports, v8::Local unused, + v8::Local context, void* priv) { + v8::Isolate* isolate = context->GetIsolate(); + mate::Dictionary dict(isolate, exports); + dict.SetMethod("_setWrapSession", &atom::api::SetWrapSession); + dict.SetMethod("_clearWrapSession", &atom::api::ClearWrapSession); +} + +} // namespace + +NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_session, Initialize) diff --git a/atom/browser/api/lib/app.coffee b/atom/browser/api/lib/app.coffee index f71297c596f0..b3446e86e23a 100644 --- a/atom/browser/api/lib/app.coffee +++ b/atom/browser/api/lib/app.coffee @@ -1,10 +1,15 @@ EventEmitter = require('events').EventEmitter bindings = process.atomBinding 'app' +sessionBindings = process.atomBinding 'session' app = bindings.app app.__proto__ = EventEmitter.prototype +wrapSession = (session) -> + # session is an Event Emitter. + session.__proto__ = EventEmitter.prototype + app.setApplicationMenu = (menu) -> require('menu').setApplicationMenu menu @@ -32,10 +37,8 @@ app.setAppPath = (path) -> app.getAppPath = -> appPath -app.once 'ready', -> - app.defaultSession.__proto__ = EventEmitter.prototype - # Be compatible with old API. - @emit 'finish-launching' +# Be compatible with old API. +app.once 'ready', -> @emit 'finish-launching' app.terminate = app.quit app.exit = process.exit app.getHomeDir = -> @getPath 'home' @@ -43,5 +46,9 @@ app.getDataPath = -> @getPath 'userData' app.setDataPath = (path) -> @setPath 'userData', path app.resolveProxy = -> @defaultSession.resolveProxy.apply @defaultSession, arguments +# Session wrapper. +sessionBindings._setWrapSession wrapSession +process.once 'exit', sessionBindings._clearWrapSession + # Only one App object pemitted. module.exports = app diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 5aed5619f9cf..09666a470b6c 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -40,6 +40,7 @@ REFERENCE_MODULE(atom_browser_power_monitor); REFERENCE_MODULE(atom_browser_power_save_blocker); REFERENCE_MODULE(atom_browser_protocol); REFERENCE_MODULE(atom_browser_global_shortcut); +REFERENCE_MODULE(atom_browser_session); REFERENCE_MODULE(atom_browser_tray); REFERENCE_MODULE(atom_browser_web_contents); REFERENCE_MODULE(atom_browser_web_view_manager); diff --git a/docs/api/app.md b/docs/api/app.md index 8951adf45cfd..db34d37ec59e 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -330,35 +330,3 @@ Sets the application's [dock menu][dock-menu]. [dock-menu]:https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/customizing_docktile/concepts/dockconcepts.html#//apple_ref/doc/uid/TP30000986-CH2-TPXREF103 [tasks]:http://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks - -## `app.defaultSession` - -The default session of the app available once the (ready)[app.md#event-ready] event is fired. - -```javascript -app.on('ready', function() { - var defaultSession = app.defaultSession; -}) -``` - -### Event: 'will-download' - -* `event` Event -* `downloadItem` Object - * `url` String - * `filename` String - * `mimeType` String - * `hasUserGesture` Boolean -* `webContents` (WebContents)[web-contents.md] - -Fired when a download is about to start. Calling `preventDefault()` -will cancel the download. - -```javascript -app.defaultSession.on('will-download', function(e, downloadItem, webContents) { - e.preventDefault(); - require('request')(downloadItem.url, function(data) { - require('fs').writeFileSync('/somewhere', data); - }); -}); -``` diff --git a/docs/api/session.md b/docs/api/session.md index 7b0c1b44c7dc..28a0c92ca655 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -13,6 +13,30 @@ win.loadUrl("http://github.com"); var session = win.webContents.session ``` +## Events + +### Event: 'will-download' + +* `event` Event +* `downloadItem` Object + * `url` String + * `filename` String + * `mimeType` String + * `hasUserGesture` Boolean +* `webContents` (WebContents)[web-contents.md] + +Fired when a download is about to start. Calling `preventDefault()` +will cancel the download. + +```javascript +session.on('will-download', function(e, downloadItem, webContents) { + e.preventDefault(); + require('request')(downloadItem.url, function(data) { + require('fs').writeFileSync('/somewhere', data); + }); +}); +``` + ## Methods The `session` object has the following methods: From 0cb20c48f6fa91131201f327da6d992599802c59 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 1 Sep 2015 20:16:28 +0800 Subject: [PATCH 46/59] docs: Small changes to will-download event --- docs/api/session.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/api/session.md b/docs/api/session.md index 28a0c92ca655..439cf8514e93 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -18,20 +18,21 @@ var session = win.webContents.session ### Event: 'will-download' * `event` Event -* `downloadItem` Object +* `item` Object * `url` String * `filename` String * `mimeType` String * `hasUserGesture` Boolean -* `webContents` (WebContents)[web-contents.md] +* `webContents` [WebContents](web-contents.md) -Fired when a download is about to start. Calling `preventDefault()` -will cancel the download. +Fired when Electron is about to download `item` in `webContents`. + +Calling `event.preventDefault()` will cancel the download. ```javascript -session.on('will-download', function(e, downloadItem, webContents) { - e.preventDefault(); - require('request')(downloadItem.url, function(data) { +session.on('will-download', function(event, item, webContents) { + event.preventDefault(); + require('request')(item.url, function(data) { require('fs').writeFileSync('/somewhere', data); }); }); From 17cc43152da044489ef31777b8864dec682cfa84 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Tue, 1 Sep 2015 16:01:44 +0200 Subject: [PATCH 47/59] Linux Build Instructions: Add list of packages for fedora --- docs/development/build-instructions-linux.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/development/build-instructions-linux.md b/docs/development/build-instructions-linux.md index 0e15252ca41f..444b7b566cf7 100644 --- a/docs/development/build-instructions-linux.md +++ b/docs/development/build-instructions-linux.md @@ -20,8 +20,16 @@ $ sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \ libxss1 libnss3-dev gcc-multilib g++-multilib ``` +On Fedora, install the following libraries: + +```bash +$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring-devel \ + xorg-x11-server-utils libcap-devel cups-devel libXtst-devel \ + alsa-lib-devel libXrandr-devel GConf2-devel nss-devel +``` + Other distributions may offer similar packages for installation via package -managers such as yum. Or one can compile from source code. +managers such as pacman. Or one can compile from source code. ## If You Use Virtual Machines For Building From 95133af0eebada235f7c330dd901b864f19848a0 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Tue, 1 Sep 2015 14:08:42 -0700 Subject: [PATCH 48/59] `y` required if `x` exists --- docs/api/menu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/menu.md b/docs/api/menu.md index eaa486390fd9..1d6e4135157d 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -211,7 +211,7 @@ will become properties of the constructed menu items. * `browserWindow` BrowserWindow * `x` Number (optional) -* `y` Number (optional) +* `y` Number (**required** if `x` is used) Pops up this menu as a context menu in the `browserWindow`. You can optionally provide a `x,y` coordinate to place the menu at, otherwise it From 2c4753270204fc984228266dc9ba7114c7f12eb6 Mon Sep 17 00:00:00 2001 From: Carson McDonald Date: Tue, 1 Sep 2015 17:15:21 -0400 Subject: [PATCH 49/59] Fix link to app.addRecentDocument --- docs/tutorial/desktop-environment-integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/desktop-environment-integration.md b/docs/tutorial/desktop-environment-integration.md index 80b4c456938b..8fd830f2be88 100644 --- a/docs/tutorial/desktop-environment-integration.md +++ b/docs/tutorial/desktop-environment-integration.md @@ -29,7 +29,7 @@ var app = require('app'); app.addRecentDocument('/Users/USERNAME/Desktop/work.type'); ``` -And you can use [app.clearRecentDocuments](clearrecentdocuments) API to empty +And you can use [app.clearRecentDocuments][clearrecentdocuments] API to empty the recent documents list: ```javascript From 2ead38b03ff6127306d30b7709fc07caecc364a3 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Tue, 1 Sep 2015 15:30:08 -0700 Subject: [PATCH 50/59] Text edits on remote --- docs/api/remote.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/api/remote.md b/docs/api/remote.md index 5658b0781656..9490c1977932 100644 --- a/docs/api/remote.md +++ b/docs/api/remote.md @@ -6,7 +6,7 @@ between the renderer process (web page) and the main process. In Electron, only GUI-unrelated modules are available in the renderer process. Without the `remote` module, users who want to call a main process API in the renderer process would have to explicitly send inter-process messages -to the main process. With the `remote` module, users can invoke methods of the +to the main process. With the `remote` module, you can invoke methods of the main process object without explicitly sending inter-process messages, similar to Java's [RMI](http://en.wikipedia.org/wiki/Java_remote_method_invocation). @@ -32,15 +32,16 @@ a new object with the remote constructor (function), you are actually sending synchronous inter-process messages. In the example above, both `BrowserWindow` and `win` were remote objects and -`new BrowserWindow` didn't create a `BrowserWindow` object in the renderer process. -Instead, it created a `BrowserWindow` object in the main process and returned the -corresponding remote object in the renderer process, namely the `win` object. +`new BrowserWindow` didn't create a `BrowserWindow` object in the renderer +process. Instead, it created a `BrowserWindow` object in the main process and +returned the corresponding remote object in the renderer process, namely the +`win` object. ## Lifetime of Remote Objects Electron makes sure that as long as the remote object in the renderer process lives (in other words, has not been garbage collected), the corresponding object -in the main process will never be released. When the remote object has been +in the main process will not be released. When the remote object has been garbage collected, the corresponding object in the main process will be dereferenced. @@ -53,7 +54,8 @@ Primary value types like strings and numbers, however, are sent by copy. ## Passing callbacks to the main process Code in the main process can accept callbacks from the renderer - for instance -the `remote` module - but you should be extremely careful when using this feature. +the `remote` module - but you should be extremely careful when using this +feature. First, in order to avoid deadlocks, the callbacks passed to the main process are called asynchronously. You should not expect the main process to @@ -110,9 +112,9 @@ But remember the callback is referenced by the main process until you explicitly uninstall it. If you do not, each time you reload your window the callback will be installed again, leaking one callback for each restart. -To make things worse, since the context of previously installed callbacks have -been released, when the `close` event was emitted exceptions will be raised in -the main process. +To make things worse, since the context of previously installed callbacks has +been released, exceptions will be raised in the main process when the `close` +event is emitted . To avoid this problem, ensure you clean up any references to renderer callbacks passed to the main process. This involves cleaning up event handlers, or From 91c75d73dd2fbcdac7547d1a8bfa817047c0122e Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Tue, 1 Sep 2015 15:42:10 -0700 Subject: [PATCH 51/59] Text edits --- docs/api/synopsis.md | 4 ++-- docs/api/tray.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/synopsis.md b/docs/api/synopsis.md index 4634151bfbec..21f4ff2aa4de 100644 --- a/docs/api/synopsis.md +++ b/docs/api/synopsis.md @@ -6,7 +6,7 @@ the [native modules](../tutorial/using-native-node-modules.md)). Electron also provides some extra built-in modules for developing native desktop applications. Some modules are only available on the main process, some -are only available on the renderer process (web page), and some can be used on +are only available in the renderer process (web page), and some can be used in both processes. The basic rule is: if a module is @@ -30,7 +30,7 @@ app.on('ready', function() { }); ``` -The render process is no different than a normal web page, except for the extra +The renderer process is no different than a normal web page, except for the extra ability to use node modules: ```html diff --git a/docs/api/tray.md b/docs/api/tray.md index c9ebf20543fe..a673307804a7 100644 --- a/docs/api/tray.md +++ b/docs/api/tray.md @@ -123,7 +123,7 @@ Emitted when dragged files are dropped in the tray icon. The `Tray` module has the following methods: -**Note**: Some methods are only available on specific operating systems and area +**Note**: Some methods are only available on specific operating systems and are labeled as such. ### `Tray.destroy()` From 47d103af72d414760c1f9c4269b03c889daee5c3 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Tue, 1 Sep 2015 16:21:29 -0700 Subject: [PATCH 52/59] Text edits --- docs/api/native-image.md | 12 ++++++------ docs/api/power-save-blocker.md | 8 ++++---- docs/api/process.md | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/api/native-image.md b/docs/api/native-image.md index 4b90fcfce612..c00ec3a9458a 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -19,20 +19,20 @@ var image = clipboard.readImage(); var appIcon = new Tray(image); ``` -## Supported formats +## Supported Formats -Currently `PNG` and `JPEG` are supported. It is recommended to use `PNG` because -of its support for transparency and lossless compression. +Currently `PNG` and `JPEG` image formats are supported. `PNG` is recommended +because of its support for transparency and lossless compression. -On Windows, you can also load `ICO` icon from a file path. +On Windows, you can also load an `ICO` icon from a file path. -## High resolution image +## High Resolution Image On platforms that have high-DPI support, you can append `@2x` after image's base filename to mark it as a high resolution image. For example if `icon.png` is a normal image that has standard resolution, then -`icon@2x.png` would be treated as a high resolution image that has double DPI +`icon@2x.png` will be treated as a high resolution image that has double DPI density. If you want to support displays with different DPI densities at the same time, diff --git a/docs/api/power-save-blocker.md b/docs/api/power-save-blocker.md index 451dde105da8..26f0abc84808 100644 --- a/docs/api/power-save-blocker.md +++ b/docs/api/power-save-blocker.md @@ -1,7 +1,7 @@ # powerSaveBlocker The `power-save-blocker` module is used to block the system from entering -low-power (sleep) mode thus allowing the app to keep the system and screen +low-power (sleep) mode and thus allowing the app to keep the system and screen active. For example: @@ -28,12 +28,12 @@ The `powerSaveBlocker` module has the following methods: * `prevent-display-sleep`- Prevent the display from going to sleep. Keeps system and screen active. Example use case: playing video. -Starts the power save blocker preventing the system from entering lower-power -mode. Returns an integer identifying the power save blocker. +Starts preventing the system from entering lower-power mode. Returns an integer +identifying the power save blocker. **Note:** `prevent-display-sleep` has higher has precedence over `prevent-app-suspension`. Only the highest precedence type takes effect. In -other words, `prevent-display-sleep` always take precedence over +other words, `prevent-display-sleep` always takes precedence over `prevent-app-suspension`. For example, an API calling A requests for `prevent-app-suspension`, and diff --git a/docs/api/process.md b/docs/api/process.md index 15a1cca19f08..120b2853bed5 100644 --- a/docs/api/process.md +++ b/docs/api/process.md @@ -1,4 +1,4 @@ -# Process +# process The `process` object in Electron has the following differences from the one in upstream node: From d830badc571502fe3ea713531f0f98d6042bc8ed Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 1 Sep 2015 19:48:11 +0800 Subject: [PATCH 53/59] Add role property for MenuItem --- atom/browser/api/atom_api_menu.cc | 5 ++ atom/browser/api/atom_api_menu.h | 1 + atom/browser/api/lib/menu-item.coffee | 3 +- atom/browser/api/lib/menu.coffee | 1 + atom/browser/default_app/main.js | 29 +++++----- atom/browser/ui/atom_menu_model.cc | 13 +++++ atom/browser/ui/atom_menu_model.h | 6 ++ atom/browser/ui/cocoa/atom_menu_controller.h | 13 ----- atom/browser/ui/cocoa/atom_menu_controller.mm | 56 +++++++++++++++---- 9 files changed, 89 insertions(+), 38 deletions(-) diff --git a/atom/browser/api/atom_api_menu.cc b/atom/browser/api/atom_api_menu.cc index 356a4d4ce494..9bd724a9612e 100644 --- a/atom/browser/api/atom_api_menu.cc +++ b/atom/browser/api/atom_api_menu.cc @@ -107,6 +107,10 @@ void Menu::SetSublabel(int index, const base::string16& sublabel) { model_->SetSublabel(index, sublabel); } +void Menu::SetRole(int index, const base::string16& role) { + model_->SetRole(index, role); +} + void Menu::Clear() { model_->Clear(); } @@ -154,6 +158,7 @@ void Menu::BuildPrototype(v8::Isolate* isolate, .SetMethod("insertSubMenu", &Menu::InsertSubMenuAt) .SetMethod("setIcon", &Menu::SetIcon) .SetMethod("setSublabel", &Menu::SetSublabel) + .SetMethod("setRole", &Menu::SetRole) .SetMethod("clear", &Menu::Clear) .SetMethod("getIndexOfCommandId", &Menu::GetIndexOfCommandId) .SetMethod("getItemCount", &Menu::GetItemCount) diff --git a/atom/browser/api/atom_api_menu.h b/atom/browser/api/atom_api_menu.h index 33aafbc45d3b..0d93c0d46be6 100644 --- a/atom/browser/api/atom_api_menu.h +++ b/atom/browser/api/atom_api_menu.h @@ -73,6 +73,7 @@ class Menu : public mate::Wrappable, Menu* menu); void SetIcon(int index, const gfx::Image& image); void SetSublabel(int index, const base::string16& sublabel); + void SetRole(int index, const base::string16& role); void Clear(); int GetIndexOfCommandId(int command_id); int GetItemCount() const; diff --git a/atom/browser/api/lib/menu-item.coffee b/atom/browser/api/lib/menu-item.coffee index d8e896f8ffa1..7663b32996d8 100644 --- a/atom/browser/api/lib/menu-item.coffee +++ b/atom/browser/api/lib/menu-item.coffee @@ -9,12 +9,13 @@ class MenuItem constructor: (options) -> Menu = require 'menu' - {click, @selector, @type, @label, @sublabel, @accelerator, @icon, @enabled, @visible, @checked, @submenu} = options + {click, @selector, @type, @role, @label, @sublabel, @accelerator, @icon, @enabled, @visible, @checked, @submenu} = options @type = 'submenu' if not @type? and @submenu? throw new Error('Invalid submenu') if @type is 'submenu' and @submenu?.constructor isnt Menu @overrideReadOnlyProperty 'type', 'normal' + @overrideReadOnlyProperty 'role' @overrideReadOnlyProperty 'accelerator' @overrideReadOnlyProperty 'icon' @overrideReadOnlyProperty 'submenu' diff --git a/atom/browser/api/lib/menu.coffee b/atom/browser/api/lib/menu.coffee index af70af740aaf..35335ffcebe5 100644 --- a/atom/browser/api/lib/menu.coffee +++ b/atom/browser/api/lib/menu.coffee @@ -115,6 +115,7 @@ Menu::insert = (pos, item) -> @setSublabel pos, item.sublabel if item.sublabel? @setIcon pos, item.icon if item.icon? + @setRole pos, item.role if item.role? # Make menu accessable to items. item.overrideReadOnlyProperty 'menu', this diff --git a/atom/browser/default_app/main.js b/atom/browser/default_app/main.js index fd3a6b596b6b..99c4ad03320b 100644 --- a/atom/browser/default_app/main.js +++ b/atom/browser/default_app/main.js @@ -44,13 +44,14 @@ app.once('ready', function() { submenu: [ { label: 'About Electron', - selector: 'orderFrontStandardAboutPanel:' + role: 'about' }, { type: 'separator' }, { label: 'Services', + role: 'services', submenu: [] }, { @@ -59,16 +60,16 @@ app.once('ready', function() { { label: 'Hide Electron', accelerator: 'Command+H', - selector: 'hide:' + role: 'hide' }, { label: 'Hide Others', accelerator: 'Command+Shift+H', - selector: 'hideOtherApplications:' + role: 'hideothers:' }, { label: 'Show All', - selector: 'unhideAllApplications:' + role: 'unhide:' }, { type: 'separator' @@ -86,12 +87,12 @@ app.once('ready', function() { { label: 'Undo', accelerator: 'Command+Z', - selector: 'undo:' + role: 'undo' }, { label: 'Redo', accelerator: 'Shift+Command+Z', - selector: 'redo:' + role: 'redo' }, { type: 'separator' @@ -99,22 +100,22 @@ app.once('ready', function() { { label: 'Cut', accelerator: 'Command+X', - selector: 'cut:' + role: 'cut' }, { label: 'Copy', accelerator: 'Command+C', - selector: 'copy:' + role: 'copy' }, { label: 'Paste', accelerator: 'Command+V', - selector: 'paste:' + role: 'paste' }, { label: 'Select All', accelerator: 'Command+A', - selector: 'selectAll:' + role: 'selectall' }, ] }, @@ -152,28 +153,30 @@ app.once('ready', function() { }, { label: 'Window', + role: 'window', submenu: [ { label: 'Minimize', accelerator: 'Command+M', - selector: 'performMiniaturize:' + role: 'minimize' }, { label: 'Close', accelerator: 'Command+W', - selector: 'performClose:' + role: 'close' }, { type: 'separator' }, { label: 'Bring All to Front', - selector: 'arrangeInFront:' + role: 'front' }, ] }, { label: 'Help', + role: 'help', submenu: [ { label: 'Learn More', diff --git a/atom/browser/ui/atom_menu_model.cc b/atom/browser/ui/atom_menu_model.cc index 7d2d5e1b6a1f..9add7a22715e 100644 --- a/atom/browser/ui/atom_menu_model.cc +++ b/atom/browser/ui/atom_menu_model.cc @@ -4,6 +4,8 @@ #include "atom/browser/ui/atom_menu_model.h" +#include "base/stl_util.h" + namespace atom { AtomMenuModel::AtomMenuModel(Delegate* delegate) @@ -14,6 +16,17 @@ AtomMenuModel::AtomMenuModel(Delegate* delegate) AtomMenuModel::~AtomMenuModel() { } +void AtomMenuModel::SetRole(int index, const base::string16& role) { + roles_[index] = role; +} + +base::string16 AtomMenuModel::GetRoleAt(int index) { + if (ContainsKey(roles_, index)) + return roles_[index]; + else + return base::string16(); +} + void AtomMenuModel::MenuClosed() { ui::SimpleMenuModel::MenuClosed(); FOR_EACH_OBSERVER(Observer, observers_, MenuClosed()); diff --git a/atom/browser/ui/atom_menu_model.h b/atom/browser/ui/atom_menu_model.h index 42e0e5dbc53a..fe19a8dc2518 100644 --- a/atom/browser/ui/atom_menu_model.h +++ b/atom/browser/ui/atom_menu_model.h @@ -5,6 +5,8 @@ #ifndef ATOM_BROWSER_UI_ATOM_MENU_MODEL_H_ #define ATOM_BROWSER_UI_ATOM_MENU_MODEL_H_ +#include + #include "base/observer_list.h" #include "ui/base/models/simple_menu_model.h" @@ -31,12 +33,16 @@ class AtomMenuModel : public ui::SimpleMenuModel { void AddObserver(Observer* obs) { observers_.AddObserver(obs); } void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); } + void SetRole(int index, const base::string16& role); + base::string16 GetRoleAt(int index); + // ui::SimpleMenuModel: void MenuClosed() override; private: Delegate* delegate_; // weak ref. + std::map roles_; ObserverList observers_; DISALLOW_COPY_AND_ASSIGN(AtomMenuModel); diff --git a/atom/browser/ui/cocoa/atom_menu_controller.h b/atom/browser/ui/cocoa/atom_menu_controller.h index da10e1b0ba66..f8c48aa5dcb5 100644 --- a/atom/browser/ui/cocoa/atom_menu_controller.h +++ b/atom/browser/ui/cocoa/atom_menu_controller.h @@ -59,17 +59,4 @@ class MenuModel; @end -// Exposed only for unit testing, do not call directly. -@interface AtomMenuController (PrivateExposedForTesting) -- (BOOL)validateUserInterfaceItem:(id)item; -@end - -// Protected methods that subclassers can override. -@interface AtomMenuController (Protected) -- (void)addItemToMenu:(NSMenu*)menu - atIndex:(NSInteger)index - fromModel:(ui::MenuModel*)model; -- (NSMenu*)menuFromModel:(ui::MenuModel*)model; -@end - #endif // ATOM_BROWSER_UI_COCOA_ATOM_MENU_CONTROLLER_H_ diff --git a/atom/browser/ui/cocoa/atom_menu_controller.mm b/atom/browser/ui/cocoa/atom_menu_controller.mm index d799a9f9b64d..e3aa78aa248c 100644 --- a/atom/browser/ui/cocoa/atom_menu_controller.mm +++ b/atom/browser/ui/cocoa/atom_menu_controller.mm @@ -8,16 +8,36 @@ #include "atom/browser/ui/atom_menu_model.h" #include "base/logging.h" #include "base/strings/sys_string_conversions.h" +#include "base/strings/utf_string_conversions.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/platform_accelerator_cocoa.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/events/cocoa/cocoa_event_utils.h" #include "ui/gfx/image/image.h" -@interface AtomMenuController (Private) -- (void)addSeparatorToMenu:(NSMenu*)menu - atIndex:(int)index; -@end +namespace { + +struct Role { + SEL selector; + const char* role; +}; +Role kRolesMap[] = { + { @selector(orderFrontStandardAboutPanel:), "about" }, + { @selector(hide:), "hide" }, + { @selector(hideOtherApplications:), "hideothers" }, + { @selector(unhideAllApplications:), "unhide" }, + { @selector(arrangeInFront:), "front" }, + { @selector(undo:), "undo" }, + { @selector(redo:), "redo" }, + { @selector(cut:), "cut" }, + { @selector(copy:), "copy" }, + { @selector(paste:), "paste" }, + { @selector(selectAll:), "selectall" }, + { @selector(performMiniaturize:), "minimize" }, + { @selector(performClose:), "close" }, +}; + +} // namespace @implementation AtomMenuController @@ -101,7 +121,9 @@ // associated with the entry in the model identified by |modelIndex|. - (void)addItemToMenu:(NSMenu*)menu atIndex:(NSInteger)index - fromModel:(ui::MenuModel*)model { + fromModel:(ui::MenuModel*)ui_model { + atom::AtomMenuModel* model = static_cast(ui_model); + base::string16 label16 = model->GetLabelAt(index); NSString* label = l10n_util::FixUpWindowsStyleLabel(label16); base::scoped_nsobject item( @@ -124,13 +146,13 @@ [submenu setTitle:[item title]]; [item setSubmenu:submenu]; - // Hack to set window and help menu. - if ([[item title] isEqualToString:@"Window"] && [submenu numberOfItems] > 0) + // Set submenu's role. + base::string16 role = model->GetRoleAt(index); + if (role == base::ASCIIToUTF16("window")) [NSApp setWindowsMenu:submenu]; - else if ([[item title] isEqualToString:@"Help"]) + else if (role == base::ASCIIToUTF16("help")) [NSApp setHelpMenu:submenu]; - if ([[item title] isEqualToString:@"Services"] && - [submenu numberOfItems] == 0) + if (role == base::ASCIIToUTF16("services")) [NSApp setServicesMenu:submenu]; } else { // The MenuModel works on indexes so we can't just set the command id as the @@ -139,7 +161,6 @@ // model. Setting the target to |self| allows this class to participate // in validation of the menu items. [item setTag:index]; - [item setTarget:self]; NSValue* modelObject = [NSValue valueWithPointer:model]; [item setRepresentedObject:modelObject]; // Retains |modelObject|. ui::Accelerator accelerator; @@ -153,6 +174,19 @@ platformAccelerator->modifier_mask()]; } } + + // Set menu item's role. + base::string16 role = model->GetRoleAt(index); + if (role.empty()) { + [item setTarget:self]; + } else { + for (const Role& pair : kRolesMap) { + if (role == base::ASCIIToUTF16(pair.role)) { + [item setAction:pair.selector]; + break; + } + } + } } [menu insertItem:item atIndex:index]; } From 7d07f10c253e3872c7c39e7a032acdf54316f477 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 1 Sep 2015 23:34:32 +0800 Subject: [PATCH 54/59] Assign actions for roles on Windows and Linux --- atom/browser/api/lib/browser-window.coffee | 6 ++++++ atom/browser/api/lib/menu-item.coffee | 19 ++++++++++++++++--- atom/browser/api/lib/menu.coffee | 3 ++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index 68b5932a93b4..283e99641f47 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -62,6 +62,12 @@ BrowserWindow::loadUrl = -> @webContents.loadUrl.apply @webContents, arguments BrowserWindow::send = -> @webContents.send.apply @webContents, arguments # Be compatible with old API. +BrowserWindow::undo = -> @webContents.undo() +BrowserWindow::redo = -> @webContents.redo() +BrowserWindow::cut = -> @webContents.cut() +BrowserWindow::copy = -> @webContents.copy() +BrowserWindow::paste = -> @webContents.paste() +BrowserWindow::selectAll = -> @webContents.selectAll() BrowserWindow::restart = -> @webContents.reload() BrowserWindow::getUrl = -> @webContents.getUrl() BrowserWindow::reload = -> @webContents.reload.apply @webContents, arguments diff --git a/atom/browser/api/lib/menu-item.coffee b/atom/browser/api/lib/menu-item.coffee index 7663b32996d8..cfefeec4edbb 100644 --- a/atom/browser/api/lib/menu-item.coffee +++ b/atom/browser/api/lib/menu-item.coffee @@ -3,6 +3,17 @@ v8Util = process.atomBinding 'v8_util' nextCommandId = 0 +# Maps role to methods of webContents +rolesMap = + undo: 'undo' + redo: 'redo' + cut: 'cut' + copy: 'copy' + paste: 'paste' + selectall: 'selectAll' + minimize: 'minimize' + close: 'close' + class MenuItem @types = ['normal', 'separator', 'submenu', 'checkbox', 'radio'] @@ -28,12 +39,14 @@ class MenuItem throw new Error("Unknown menu type #{@type}") if MenuItem.types.indexOf(@type) is -1 @commandId = ++nextCommandId - @click = => + @click = (focusedWindow) => # Manually flip the checked flags when clicked. @checked = !@checked if @type in ['checkbox', 'radio'] - if typeof click is 'function' - click this, BrowserWindow.getFocusedWindow() + if @role and rolesMap[@role] and process.platform isnt 'darwin' + focusedWindow?[rolesMap[@role]]() + else if typeof click is 'function' + click this, focusedWindow else if typeof @selector is 'string' Menu.sendActionToFirstResponder @selector diff --git a/atom/browser/api/lib/menu.coffee b/atom/browser/api/lib/menu.coffee index 35335ffcebe5..3595ba1fe7db 100644 --- a/atom/browser/api/lib/menu.coffee +++ b/atom/browser/api/lib/menu.coffee @@ -67,7 +67,8 @@ Menu::_init = -> isCommandIdVisible: (commandId) => @commandsMap[commandId]?.visible getAcceleratorForCommandId: (commandId) => @commandsMap[commandId]?.accelerator getIconForCommandId: (commandId) => @commandsMap[commandId]?.icon - executeCommand: (commandId) => @commandsMap[commandId]?.click() + executeCommand: (commandId) => + @commandsMap[commandId]?.click BrowserWindow.getFocusedWindow() menuWillShow: => # Make sure radio groups have at least one menu item seleted. for id, group of @groupsMap From 009b27f5f153ee8ae46508af98456c06e4a1b471 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 1 Sep 2015 23:34:56 +0800 Subject: [PATCH 55/59] Unify the menu of default app --- atom/browser/default_app/main.js | 395 +++++++++++++------------------ 1 file changed, 165 insertions(+), 230 deletions(-) diff --git a/atom/browser/default_app/main.js b/atom/browser/default_app/main.js index 99c4ad03320b..4d854dc35cbc 100644 --- a/atom/browser/default_app/main.js +++ b/atom/browser/default_app/main.js @@ -36,241 +36,176 @@ app.once('ready', function() { if (Menu.getApplicationMenu()) return; - var template; + var template = [ + { + label: 'Edit', + submenu: [ + { + label: 'Undo', + accelerator: 'CmdOrCtrl+Z', + role: 'undo' + }, + { + label: 'Redo', + accelerator: 'Shift+CmdOrCtrl+Z', + role: 'redo' + }, + { + type: 'separator' + }, + { + label: 'Cut', + accelerator: 'CmdOrCtrl+X', + role: 'cut' + }, + { + label: 'Copy', + accelerator: 'CmdOrCtrl+C', + role: 'copy' + }, + { + label: 'Paste', + accelerator: 'CmdOrCtrl+V', + role: 'paste' + }, + { + label: 'Select All', + accelerator: 'CmdOrCtrl+A', + role: 'selectall' + }, + ] + }, + { + label: 'View', + submenu: [ + { + label: 'Reload', + accelerator: 'CmdOrCtrl+R', + click: function(item, focusedWindow) { + if (focusedWindow) + focusedWindow.reload(); + } + }, + { + label: 'Toggle Full Screen', + accelerator: (function() { + if (process.platform == 'darwin') + return 'Ctrl+Command+F'; + else + return 'F11'; + })(), + click: function(item, focusedWindow) { + if (focusedWindow) + focusedWindow.setFullScreen(!focusedWindow.isFullScreen()); + } + }, + { + label: 'Toggle Developer Tools', + accelerator: (function() { + if (process.platform == 'darwin') + return 'Alt+Command+I'; + else + return 'Ctrl+Shift+I'; + })(), + click: function(item, focusedWindow) { + if (focusedWindow) + focusedWindow.toggleDevTools(); + } + }, + ] + }, + { + label: 'Window', + role: 'window', + submenu: [ + { + label: 'Minimize', + accelerator: 'CmdOrCtrl+M', + role: 'minimize' + }, + { + label: 'Close', + accelerator: 'CmdOrCtrl+W', + role: 'close' + }, + ] + }, + { + label: 'Help', + role: 'help', + submenu: [ + { + label: 'Learn More', + click: function() { require('shell').openExternal('http://electron.atom.io') } + }, + { + label: 'Documentation', + click: function() { require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme') } + }, + { + label: 'Community Discussions', + click: function() { require('shell').openExternal('https://discuss.atom.io/c/electron') } + }, + { + label: 'Search Issues', + click: function() { require('shell').openExternal('https://github.com/atom/electron/issues') } + } + ] + }, + ]; + if (process.platform == 'darwin') { - template = [ + template.unshift({ + label: 'Electron', + submenu: [ + { + label: 'About Electron', + role: 'about' + }, + { + type: 'separator' + }, + { + label: 'Services', + role: 'services', + submenu: [] + }, + { + type: 'separator' + }, + { + label: 'Hide Electron', + accelerator: 'Command+H', + role: 'hide' + }, + { + label: 'Hide Others', + accelerator: 'Command+Shift+H', + role: 'hideothers:' + }, + { + label: 'Show All', + role: 'unhide:' + }, + { + type: 'separator' + }, + { + label: 'Quit', + accelerator: 'Command+Q', + click: function() { app.quit(); } + }, + ] + }); + template[3].submenu.push( { - label: 'Electron', - submenu: [ - { - label: 'About Electron', - role: 'about' - }, - { - type: 'separator' - }, - { - label: 'Services', - role: 'services', - submenu: [] - }, - { - type: 'separator' - }, - { - label: 'Hide Electron', - accelerator: 'Command+H', - role: 'hide' - }, - { - label: 'Hide Others', - accelerator: 'Command+Shift+H', - role: 'hideothers:' - }, - { - label: 'Show All', - role: 'unhide:' - }, - { - type: 'separator' - }, - { - label: 'Quit', - accelerator: 'Command+Q', - click: function() { app.quit(); } - }, - ] + type: 'separator' }, { - label: 'Edit', - submenu: [ - { - label: 'Undo', - accelerator: 'Command+Z', - role: 'undo' - }, - { - label: 'Redo', - accelerator: 'Shift+Command+Z', - role: 'redo' - }, - { - type: 'separator' - }, - { - label: 'Cut', - accelerator: 'Command+X', - role: 'cut' - }, - { - label: 'Copy', - accelerator: 'Command+C', - role: 'copy' - }, - { - label: 'Paste', - accelerator: 'Command+V', - role: 'paste' - }, - { - label: 'Select All', - accelerator: 'Command+A', - role: 'selectall' - }, - ] - }, - { - label: 'View', - submenu: [ - { - label: 'Reload', - accelerator: 'Command+R', - click: function() { - var focusedWindow = BrowserWindow.getFocusedWindow(); - if (focusedWindow) - focusedWindow.reload(); - } - }, - { - label: 'Toggle Full Screen', - accelerator: 'Ctrl+Command+F', - click: function() { - var focusedWindow = BrowserWindow.getFocusedWindow(); - if (focusedWindow) - focusedWindow.setFullScreen(!focusedWindow.isFullScreen()); - } - }, - { - label: 'Toggle Developer Tools', - accelerator: 'Alt+Command+I', - click: function() { - var focusedWindow = BrowserWindow.getFocusedWindow(); - if (focusedWindow) - focusedWindow.toggleDevTools(); - } - }, - ] - }, - { - label: 'Window', - role: 'window', - submenu: [ - { - label: 'Minimize', - accelerator: 'Command+M', - role: 'minimize' - }, - { - label: 'Close', - accelerator: 'Command+W', - role: 'close' - }, - { - type: 'separator' - }, - { - label: 'Bring All to Front', - role: 'front' - }, - ] - }, - { - label: 'Help', - role: 'help', - submenu: [ - { - label: 'Learn More', - click: function() { require('shell').openExternal('http://electron.atom.io') } - }, - { - label: 'Documentation', - click: function() { require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme') } - }, - { - label: 'Community Discussions', - click: function() { require('shell').openExternal('https://discuss.atom.io/c/electron') } - }, - { - label: 'Search Issues', - click: function() { require('shell').openExternal('https://github.com/atom/electron/issues') } - } - ] + label: 'Bring All to Front', + role: 'front' } - ]; - } else { - template = [ - { - label: '&File', - submenu: [ - { - label: '&Open', - accelerator: 'Ctrl+O', - }, - { - label: '&Close', - accelerator: 'Ctrl+W', - click: function() { - var focusedWindow = BrowserWindow.getFocusedWindow(); - if (focusedWindow) - focusedWindow.close(); - } - }, - ] - }, - { - label: '&View', - submenu: [ - { - label: '&Reload', - accelerator: 'Ctrl+R', - click: function() { - var focusedWindow = BrowserWindow.getFocusedWindow(); - if (focusedWindow) - focusedWindow.reload(); - } - }, - { - label: 'Toggle &Full Screen', - accelerator: 'F11', - click: function() { - var focusedWindow = BrowserWindow.getFocusedWindow(); - if (focusedWindow) - focusedWindow.setFullScreen(!focusedWindow.isFullScreen()); - } - }, - { - label: 'Toggle &Developer Tools', - accelerator: 'Shift+Ctrl+I', - click: function() { - var focusedWindow = BrowserWindow.getFocusedWindow(); - if (focusedWindow) - focusedWindow.toggleDevTools(); - } - }, - ] - }, - { - label: 'Help', - submenu: [ - { - label: 'Learn More', - click: function() { require('shell').openExternal('http://electron.atom.io') } - }, - { - label: 'Documentation', - click: function() { require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme') } - }, - { - label: 'Community Discussions', - click: function() { require('shell').openExternal('https://discuss.atom.io/c/electron') } - }, - { - label: 'Search Issues', - click: function() { require('shell').openExternal('https://github.com/atom/electron/issues') } - } - ] - } - ]; + ); } var menu = Menu.buildFromTemplate(template); From 6bce5b560bc04b9caa720bb89a73f3096a0ac120 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 2 Sep 2015 09:19:18 +0800 Subject: [PATCH 56/59] docs: The "role" attribute of MenuItem --- docs/api/dialog.md | 3 +- docs/api/menu-item.md | 33 ++++++- docs/api/menu.md | 201 ++++++++++++++++++++++++------------------ 3 files changed, 147 insertions(+), 90 deletions(-) diff --git a/docs/api/dialog.md b/docs/api/dialog.md index d00540e62df9..0fadfa37f80c 100644 --- a/docs/api/dialog.md +++ b/docs/api/dialog.md @@ -48,12 +48,13 @@ selected when you want to limit the user to a specific type. For example: ] } ``` + The `extensions` array should contain extensions without wildcards or dots (e.g. `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the `'*'` wildcard (no other wildcard is supported). If a `callback` is passed, the API call will be asynchronous and the result -wil be passed via `callback(filenames)` +will be passed via `callback(filenames)` **Note:** On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set `properties` to diff --git a/docs/api/menu-item.md b/docs/api/menu-item.md index 71b69b850a69..89524d9f2352 100644 --- a/docs/api/menu-item.md +++ b/docs/api/menu-item.md @@ -12,9 +12,10 @@ Create a new `MenuItem` with the following method: ### new MenuItem(options) * `options` Object - * `click` Function - Callback when the menu item is clicked - * `selector` String - Call the selector of first responder when clicked (OS - X only) + * `click` Function - Will be called with `click(menuItem, browserWindow)` when + the menu item is clicked + * `role` String - Define the action of the menu item, when specified the + `click` property will be ignored * `type` String - Can be `normal`, `separator`, `submenu`, `checkbox` or `radio` * `label` String @@ -30,3 +31,29 @@ Create a new `MenuItem` with the following method: as a reference to this item by the position attribute. * `position` String - This field allows fine-grained definition of the specific location within a given menu. + +When creating menu items, it is recommended to specify `role` instead of +manually implementing the behavior if there is matching action, so menu can have +best native experience. + +The `role` property can have following values: + +* `undo` +* `redo` +* `cut` +* `copy` +* `paste` +* `selectall` +* `minimize` - Minimize current window +* `close` - Close current window + +On OS X `role` can also have following additional values: + +* `about` - Map to the `orderFrontStandardAboutPanel` action +* `hide` - Map to the `hide` action +* `hideothers` - Map to the `hideOtherApplications` action +* `unhide` - Map to the `unhideAllApplications` action +* `front` - Map to the `arrangeInFront` action +* `window` - The submenu is a "Window" menu +* `help` - The submenu is a "Help" menu +* `services` - The submenu is a "Services" menu diff --git a/docs/api/menu.md b/docs/api/menu.md index 1d6e4135157d..49d6361bcf0b 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -35,68 +35,20 @@ window.addEventListener('contextmenu', function (e) { An example of creating the application menu in the render process with the simple template API: -**Note to Window and Linux users** the `selector` member of each menu item is a -Mac-only [Accelerator option](https://github.com/atom/electron/blob/master/docs/api/accelerator.md). - -```html - - ``` ## Class: Menu @@ -242,29 +272,26 @@ Linux, here are some notes on making your app's menu more native-like. ### Standard Menus On OS X there are many system defined standard menus, like the `Services` and -`Windows` menus. To make your menu a standard menu, you can just set your menu's -label to one of following and Electron will recognize them and make them +`Windows` menus. To make your menu a standard menu, you should set your menu's +`role` to one of following and Electron will recognize them and make them become standard menus: -* `Window` -* `Help` -* `Services` +* `window` +* `help` +* `services` ### Standard Menu Item Actions -OS X has provided standard actions for some menu items (which are called -`selector`s), like `About xxx`, `Hide xxx`, and `Hide Others`. To set the action -of a menu item to a standard action, you can set the `selector` attribute of the -menu item. +OS X has provided standard actions for some menu items, like `About xxx`, +`Hide xxx`, and `Hide Others`. To set the action of a menu item to a standard +action, you should set the `role` attribute of the menu item. ### Main Menu's Name On OS X the label of application menu's first item is always your app's name, no matter what label you set. To change it you have to change your app's name -by modifying your app bundle's `Info.plist` file. See -[About Information Property List Files](https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html) -for more information. - +by modifying your app bundle's `Info.plist` file. See [About Information +Property List Files][AboutInformationPropertyListFiles] for more information. ## Menu Item Position @@ -339,3 +366,5 @@ Menu: - 2 - 3 ``` + +[AboutInformationPropertyListFiles]: https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html From 0fa0aedd86105a33ba1d0019a6cc1e5832de491b Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Tue, 1 Sep 2015 19:08:31 -0700 Subject: [PATCH 57/59] Text edits --- docs/api/protocol.md | 22 ++++++++++++---------- docs/api/remote.md | 6 +++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/docs/api/protocol.md b/docs/api/protocol.md index ba4160d7c321..795e4340c7ee 100644 --- a/docs/api/protocol.md +++ b/docs/api/protocol.md @@ -22,7 +22,8 @@ app.on('ready', function() { }); ``` -**Note:** This module can only be used after the `ready` event was emitted. +**Note:** This module can only be used after the `ready` event in the `app` +module is emitted. ## Methods @@ -42,10 +43,11 @@ includes `file:` and `filesystem:`. * `handler` Function * `completion` Function (optional) -Registers a protocol of `scheme` that will send the file as a response. The `handler` -will be called with `handler(request, callback)` when a `request` is going to be -created with `scheme` and `completion` will be called with `completion(null)` -when `scheme` is successfully registered, or `completion(error)` when failed. +Registers a protocol of `scheme` that will send the file as a response. The +`handler` will be called with `handler(request, callback)` when a `request` is +going to be created with `scheme`. `completion` will be called with +`completion(null)` when `scheme` is successfully registered or +`completion(error)` when failed. To handle the `request`, the `callback` should be called with either the file's path or an object that has a `path` property, e.g. `callback(filePath)` or @@ -53,13 +55,13 @@ path or an object that has a `path` property, e.g. `callback(filePath)` or When `callback` is called with nothing, a number, or an object that has an `error` property, the `request` will fail with the `error` number you -specified. For the available error numbers you can use, please see: -https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h +specified. For the available error numbers you can use, please see the +[net error list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h). By default the `scheme` is treated like `http:`, which is parsed differently -from protocols that follow "generic URI syntax" like `file:`, so you probably -want to call `protocol.registerStandardSchemes` to have your scheme treated as a -standard scheme. +than protocols that follow the "generic URI syntax" like `file:`, so you +probably want to call `protocol.registerStandardSchemes` to have your scheme +treated as a standard scheme. ### `protocol.registerBufferProtocol(scheme, handler[, completion])` diff --git a/docs/api/remote.md b/docs/api/remote.md index 9490c1977932..ccb16b4b3cc3 100644 --- a/docs/api/remote.md +++ b/docs/api/remote.md @@ -1,11 +1,11 @@ # remote The `remote` module provides a simple way to do inter-process communication -between the renderer process (web page) and the main process. +(IPC) between the renderer process (web page) and the main process. In Electron, only GUI-unrelated modules are available in the renderer process. Without the `remote` module, users who want to call a main process API in -the renderer process would have to explicitly send inter-process messages +the renderer process will have to explicitly send inter-process messages to the main process. With the `remote` module, you can invoke methods of the main process object without explicitly sending inter-process messages, similar to Java's [RMI](http://en.wikipedia.org/wiki/Java_remote_method_invocation). @@ -114,7 +114,7 @@ callback will be installed again, leaking one callback for each restart. To make things worse, since the context of previously installed callbacks has been released, exceptions will be raised in the main process when the `close` -event is emitted . +event is emitted. To avoid this problem, ensure you clean up any references to renderer callbacks passed to the main process. This involves cleaning up event handlers, or From f5f3278ffa82f7ce4fd4e0e6af1276a3c8cf1ced Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 2 Sep 2015 11:11:27 +0800 Subject: [PATCH 58/59] Bump v0.31.2 --- atom.gyp | 2 +- atom/browser/resources/mac/Info.plist | 2 +- atom/browser/resources/win/atom.rc | 8 ++++---- atom/common/atom_version.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atom.gyp b/atom.gyp index 08885b3ef532..c0fc40187984 100644 --- a/atom.gyp +++ b/atom.gyp @@ -4,7 +4,7 @@ 'product_name%': 'Electron', 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', - 'version%': '0.31.0', + 'version%': '0.31.2', }, 'includes': [ 'filenames.gypi', diff --git a/atom/browser/resources/mac/Info.plist b/atom/browser/resources/mac/Info.plist index a9076b830eb4..73facdc7f565 100644 --- a/atom/browser/resources/mac/Info.plist +++ b/atom/browser/resources/mac/Info.plist @@ -17,7 +17,7 @@ CFBundleIconFile atom.icns CFBundleVersion - 0.31.0 + 0.31.2 LSMinimumSystemVersion 10.8.0 NSMainNibFile diff --git a/atom/browser/resources/win/atom.rc b/atom/browser/resources/win/atom.rc index c97106298bf8..7e7fea9f2fb3 100644 --- a/atom/browser/resources/win/atom.rc +++ b/atom/browser/resources/win/atom.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,31,0,0 - PRODUCTVERSION 0,31,0,0 + FILEVERSION 0,31,2,0 + PRODUCTVERSION 0,31,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,12 +74,12 @@ BEGIN BEGIN VALUE "CompanyName", "GitHub, Inc." VALUE "FileDescription", "Electron" - VALUE "FileVersion", "0.31.0" + VALUE "FileVersion", "0.31.2" VALUE "InternalName", "electron.exe" VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "OriginalFilename", "electron.exe" VALUE "ProductName", "Electron" - VALUE "ProductVersion", "0.31.0" + VALUE "ProductVersion", "0.31.2" VALUE "SquirrelAwareVersion", "1" END END diff --git a/atom/common/atom_version.h b/atom/common/atom_version.h index 483bf382c265..a0b865b0e2a6 100644 --- a/atom/common/atom_version.h +++ b/atom/common/atom_version.h @@ -7,7 +7,7 @@ #define ATOM_MAJOR_VERSION 0 #define ATOM_MINOR_VERSION 31 -#define ATOM_PATCH_VERSION 0 +#define ATOM_PATCH_VERSION 2 #define ATOM_VERSION_IS_RELEASE 1 From e71d2bd8e77e101891115db09529b5a5456b7a6a Mon Sep 17 00:00:00 2001 From: Antonio Stoilkov Date: Wed, 2 Sep 2015 14:18:17 +0300 Subject: [PATCH 59/59] Clarify Selenium and WebDriver documentation --- docs/tutorial/using-selenium-and-webdriver.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/tutorial/using-selenium-and-webdriver.md b/docs/tutorial/using-selenium-and-webdriver.md index f3b7310dfbe5..058603784e22 100644 --- a/docs/tutorial/using-selenium-and-webdriver.md +++ b/docs/tutorial/using-selenium-and-webdriver.md @@ -8,14 +8,8 @@ From [ChromeDriver - WebDriver for Chrome][chrome-driver]: > implements WebDriver's wire protocol for Chromium. It is being developed by > members of the Chromium and WebDriver teams. -In Electron's [releases](https://github.com/atom/electron/releases) page you -can find archives of `chromedriver`, there is no difference between Electron's -distribution of `chromedriver` and upstream ones, so in order to use -`chromedriver` together with Electron, you will need some special setup. - -Also notice that only minor version update releases (e.g. `vX.X.0` releases) -include `chromedriver` archives, because `chromedriver` doesn't change as -frequent as Electron itself. +In order to use `chromedriver` together with Electron you have to tell it where to +find Electron and make it think Electron is Chrome browser. ## Setting up with WebDriverJs