Merge branch 'master' into jl-std-docs-2
This commit is contained in:
commit
0a4144e67a
60 changed files with 559 additions and 457 deletions
31
README-ko.md
31
README-ko.md
|
@ -1,4 +1,4 @@
|
||||||
[](http://electron.atom.io/)
|
[](http://electron.atom.io/)
|
||||||
|
|
||||||
[](https://travis-ci.org/atom/electron)
|
[](https://travis-ci.org/atom/electron)
|
||||||
[](https://david-dm.org/atom/electron#info=devDependencies)
|
[](https://david-dm.org/atom/electron#info=devDependencies)
|
||||||
|
@ -8,23 +8,22 @@
|
||||||
|
|
||||||
:zap: *이전까지 Atom Shell로 알려져 있었습니다* :zap:
|
:zap: *이전까지 Atom Shell로 알려져 있었습니다* :zap:
|
||||||
|
|
||||||
|
Electron 프레임워크는 JavaScript, HTML 그리고 CSS를 사용하여 Cross-Platform 데스크톱 어플리케이션을 개발할 수 있도록 해주는 프레임워크입니다. 이 프레임워크는 [io.js](http://iojs.org) 와
|
||||||
|
[Chromium](http://www.chromium.org)을 기반으로 만들어 졌으며 [Atom Editor](https://github.com/atom/atom)에 사용되고 있습니다.
|
||||||
|
|
||||||
Electron은 JavaScript, HTML 그리고 CSS를 이용하여 Cross-Platform 데스크톱 어플리케이션을 개발할 수 있도록 해주는 프레임워크입니다. 이 프레임워크는 [io.js](http://iojs.org) 와
|
Electron에 대한 중요한 알림을 받고 싶다면 Twitter에서 [@ElectronJS](https://twitter.com/electronjs)를 팔로우 하세요.
|
||||||
[Chromium](http://www.chromium.org) 을 기반으로 만들어 졌으며 [Atom Editor](https://github.com/atom/atom) 에 사용되고 있습니다.
|
|
||||||
|
|
||||||
Electron에 대한 중요한 알림을 받으려면 Twitter에서 [@ElectronJS](https://twitter.com/electronjs)를 Follow하세요.
|
|
||||||
|
|
||||||
## 다운로드
|
## 다운로드
|
||||||
|
|
||||||
Linux, Windows, Mac용으로 미리 빌드된 Electron 바이너리와 디버그 심볼이 준비되어 있습니다. [releases](https://github.com/atom/electron/releases) 페이지에서 받아 볼 수 있습니다.
|
Linux, Windows, Mac용으로 미리 빌드된 Electron 바이너리와 디버그 심볼이 준비되어 있습니다. [releases](https://github.com/atom/electron/releases) 페이지에서 받아 볼 수 있습니다.
|
||||||
|
|
||||||
또한 [`npm`](https://docs.npmjs.com/)을 이용하여 미리 빌드된 Electron 바이너리를 받을 수 있습니다:
|
또한 [`npm`](https://docs.npmjs.com/)을 통해 미리 빌드된 Electron 바이너리를 받을 수도 있습니다:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# $PATH에 `electron`을 등록하고 전역에 설치합니다.
|
# $PATH에 `electron` 커맨드를 등록하고 전역에 설치합니다.
|
||||||
npm install electron-prebuilt -g
|
npm install electron-prebuilt -g
|
||||||
|
|
||||||
# 개발용 dependency로 설치합니다.
|
# 개발 의존성 모듈 형태로 설치합니다.
|
||||||
npm install electron-prebuilt --save-dev
|
npm install electron-prebuilt --save-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -32,13 +31,19 @@ npm install electron-prebuilt --save-dev
|
||||||
|
|
||||||
- [China](https://npm.taobao.org/mirrors/electron)
|
- [China](https://npm.taobao.org/mirrors/electron)
|
||||||
|
|
||||||
## 참조문서
|
## 참조 문서
|
||||||
|
|
||||||
[docs](https://github.com/atom/electron/tree/master/docs/README-ko.md) 에 프레임워크 사용 가이드와 API 레퍼런스가 있습니다.
|
[Docs](https://github.com/atom/electron/tree/master/docs/README.md)에 개발 가이드와 API 레퍼런스가 있습니다.
|
||||||
추가적으로 Electron을 빌드 하는 방법과 프로젝트에 기여하는 방법이 문서에 포함되어 있으니 참고하시기 바랍니다.
|
Electron을 빌드 하는 방법과 프로젝트에 기여하는 방법도 문서에 포함되어 있으니 참고하시기 바랍니다.
|
||||||
|
|
||||||
|
## 참조 문서(번역)
|
||||||
|
|
||||||
|
- [한국어](https://github.com/atom/electron/tree/master/docs-translations/ko)
|
||||||
|
- [일본어](https://github.com/atom/electron/tree/master/docs-translations/jp)
|
||||||
|
- [스페인어](https://github.com/atom/electron/tree/master/docs-translations/es)
|
||||||
|
|
||||||
## 커뮤니티
|
## 커뮤니티
|
||||||
|
|
||||||
[Atom 포럼내의 `electron` 카테고리](http://discuss.atom.io/category/electron) 와 Freenode `#atom-shell` 채팅채널이 있습니다.
|
[Atom 포럼내의 `electron` 카테고리](http://discuss.atom.io/category/electron)와 Freenode `#atom-shell` 채팅 채널에서 활발하게 토론이 이어지고 있습니다.
|
||||||
|
|
||||||
[awesome-electron](https://github.com/sindresorhus/awesome-electron) 에 커뮤니티가 운영중인 유용한 예제 앱과 툴, 리소스가 있으니 한번 탐색해 보시기 바랍니다.
|
[awesome-electron](https://github.com/sindresorhus/awesome-electron) 프로젝트엔 커뮤니티가 운영중인 유용한 예제 어플리케이션과 도구, 리소스가 있으니 한번 참고해 보시기 바랍니다.
|
||||||
|
|
|
@ -92,5 +92,8 @@ app.setAppPath packagePath
|
||||||
# Load the chrome extension support.
|
# Load the chrome extension support.
|
||||||
require './chrome-extension'
|
require './chrome-extension'
|
||||||
|
|
||||||
|
# Set main startup script of the app.
|
||||||
|
mainStartupScript = packageJson.main or 'index.js'
|
||||||
|
|
||||||
# Finally load app's main.js and transfer control to C++.
|
# Finally load app's main.js and transfer control to C++.
|
||||||
Module._load path.join(packagePath, packageJson.main), Module, true
|
Module._load path.join(packagePath, mainStartupScript), Module, true
|
||||||
|
|
|
@ -82,9 +82,6 @@ class NativeWindowMac : public NativeWindow {
|
||||||
// Called to handle a mouse event.
|
// Called to handle a mouse event.
|
||||||
void HandleMouseEvent(NSEvent* event);
|
void HandleMouseEvent(NSEvent* event);
|
||||||
|
|
||||||
// Clip web view to rounded corner.
|
|
||||||
void ClipWebView();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// NativeWindow:
|
// NativeWindow:
|
||||||
void HandleKeyboardEvent(
|
void HandleKeyboardEvent(
|
||||||
|
|
|
@ -22,9 +22,6 @@
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// The radius of rounded corner.
|
|
||||||
const CGFloat kAtomWindowCornerRadius = 4.0;
|
|
||||||
|
|
||||||
// Prevents window from resizing during the scope.
|
// Prevents window from resizing during the scope.
|
||||||
class ScopedDisableResize {
|
class ScopedDisableResize {
|
||||||
public:
|
public:
|
||||||
|
@ -41,10 +38,6 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@interface NSView (PrivateMethods)
|
|
||||||
- (CGFloat)roundedCornerRadius;
|
|
||||||
@end
|
|
||||||
|
|
||||||
// This view always takes the size of its superview. It is intended to be used
|
// This view always takes the size of its superview. It is intended to be used
|
||||||
// as a NSWindow's contentView. It is needed because NSWindow's implementation
|
// as a NSWindow's contentView. It is needed because NSWindow's implementation
|
||||||
// explicitly resizes the contentView at inopportune times.
|
// explicitly resizes the contentView at inopportune times.
|
||||||
|
@ -153,9 +146,6 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResize:(NSNotification*)notification {
|
- (void)windowDidResize:(NSNotification*)notification {
|
||||||
if (!shell_->has_frame())
|
|
||||||
shell_->ClipWebView();
|
|
||||||
|
|
||||||
shell_->NotifyWindowResize();
|
shell_->NotifyWindowResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,8 +603,8 @@ void NativeWindowMac::Center() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetTitle(const std::string& title) {
|
void NativeWindowMac::SetTitle(const std::string& title) {
|
||||||
// We don't want the title to show in transparent window.
|
// We don't want the title to show in transparent or frameless window.
|
||||||
if (transparent())
|
if (transparent() || !has_frame())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[window_ setTitle:base::SysUTF8ToNSString(title)];
|
[window_ setTitle:base::SysUTF8ToNSString(title)];
|
||||||
|
@ -804,16 +794,14 @@ void NativeWindowMac::HandleKeyboardEvent(
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::InstallView() {
|
void NativeWindowMac::InstallView() {
|
||||||
|
// Make sure the bottom corner is rounded: http://crbug.com/396264.
|
||||||
|
[[window_ contentView] setWantsLayer:YES];
|
||||||
|
|
||||||
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();
|
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();
|
||||||
if (has_frame()) {
|
if (has_frame()) {
|
||||||
// Add layer with white background for the contents view.
|
|
||||||
base::scoped_nsobject<CALayer> layer([[CALayer alloc] init]);
|
|
||||||
[layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
|
|
||||||
[view setLayer:layer];
|
|
||||||
[view setFrame:[[window_ contentView] bounds]];
|
[view setFrame:[[window_ contentView] bounds]];
|
||||||
[[window_ contentView] addSubview:view];
|
[[window_ contentView] addSubview:view];
|
||||||
} else {
|
} else {
|
||||||
if (base::mac::IsOSYosemiteOrLater()) {
|
|
||||||
// In OSX 10.10, adding subviews to the root view for the NSView hierarchy
|
// In OSX 10.10, adding subviews to the root view for the NSView hierarchy
|
||||||
// produces warnings. To eliminate the warnings, we resize the contentView
|
// produces warnings. To eliminate the warnings, we resize the contentView
|
||||||
// to fill the window, and add subviews to that.
|
// to fill the window, and add subviews to that.
|
||||||
|
@ -826,13 +814,7 @@ void NativeWindowMac::InstallView() {
|
||||||
|
|
||||||
[view setFrame:[content_view_ bounds]];
|
[view setFrame:[content_view_ bounds]];
|
||||||
[content_view_ addSubview:view];
|
[content_view_ addSubview:view];
|
||||||
} else {
|
|
||||||
NSView* frameView = [[window_ contentView] superview];
|
|
||||||
[view setFrame:[frameView bounds]];
|
|
||||||
[frameView addSubview:view];
|
|
||||||
}
|
|
||||||
|
|
||||||
ClipWebView();
|
|
||||||
InstallDraggableRegionView();
|
InstallDraggableRegionView();
|
||||||
|
|
||||||
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
||||||
|
@ -851,14 +833,6 @@ void NativeWindowMac::UninstallView() {
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::ClipWebView() {
|
|
||||||
if (!web_contents())
|
|
||||||
return;
|
|
||||||
NSView* webView = web_contents()->GetNativeView();
|
|
||||||
webView.layer.masksToBounds = YES;
|
|
||||||
webView.layer.cornerRadius = kAtomWindowCornerRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NativeWindowMac::InstallDraggableRegionView() {
|
void NativeWindowMac::InstallDraggableRegionView() {
|
||||||
NSView* webView = web_contents()->GetNativeView();
|
NSView* webView = web_contents()->GetNativeView();
|
||||||
base::scoped_nsobject<NSView> controlRegion(
|
base::scoped_nsobject<NSView> controlRegion(
|
||||||
|
|
|
@ -207,8 +207,14 @@ const CGFloat kVerticalTitleMargin = 2;
|
||||||
}
|
}
|
||||||
inMouseEventSequence_ = NO;
|
inMouseEventSequence_ = NO;
|
||||||
|
|
||||||
// Show menu when single clicked on the icon.
|
// Show menu when there is a context menu.
|
||||||
if (event.clickCount == 1 && menuController_)
|
// NB(hokein): Make tray's behavior more like official one's.
|
||||||
|
// When the tray icon gets clicked quickly multiple times, the
|
||||||
|
// event.clickCount doesn't always return 1. Instead, it returns a value that
|
||||||
|
// counts the clicked times.
|
||||||
|
// So we don't check the clickCount here, just pop up the menu for each click
|
||||||
|
// event.
|
||||||
|
if (menuController_)
|
||||||
[statusItem_ popUpStatusItemMenu:[menuController_ menu]];
|
[statusItem_ popUpStatusItemMenu:[menuController_ menu]];
|
||||||
|
|
||||||
// Don't emit click events when menu is showing.
|
// Don't emit click events when menu is showing.
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
## 개발 가이드
|
|
||||||
|
|
||||||
* [어플리케이션 배포](tutorial/application-distribution-ko.md)
|
|
||||||
* [어플리케이션 패키징](tutorial/application-packaging-ko.md)
|
|
||||||
* [네이티브 node 모듈 사용하기](tutorial/using-native-node-modules-ko.md)
|
|
||||||
* [메인 프로세스 디버깅하기](tutorial/debugging-main-process-ko.md)
|
|
||||||
* [Selenium 과 WebDriver 사용하기](tutorial/using-selenium-and-webdriver-ko.md)
|
|
||||||
* [개발자 콘솔 확장기능](tutorial/devtools-extension-ko.md)
|
|
||||||
* [Pepper 플래시 플러그인 사용하기](tutorial/using-pepper-flash-plugin-ko.md)
|
|
||||||
|
|
||||||
## 튜토리얼
|
|
||||||
|
|
||||||
* [시작하기](tutorial/quick-start-ko.md)
|
|
||||||
* [데스크톱 환경 통합](tutorial/desktop-environment-integration-ko.md)
|
|
||||||
* [온라인/오프라인 이벤트](tutorial/online-offline-events-ko.md)
|
|
||||||
|
|
||||||
## API 레퍼런스
|
|
||||||
|
|
||||||
* [개요](api/synopsis-ko.md)
|
|
||||||
* [프로세스 객체](api/process-ko.md)
|
|
||||||
* [크롬 Command-Line 스위치 지원](api/chrome-command-line-switches-ko.md)
|
|
||||||
|
|
||||||
커스텀 DOM Element:
|
|
||||||
|
|
||||||
* [`File` 객체](api/file-object-ko.md)
|
|
||||||
* [`<webview>` 태그](api/web-view-tag-ko.md)
|
|
||||||
* [`window.open` 함수](api/window-open-ko.md)
|
|
||||||
|
|
||||||
메인 프로세스를 위한 모듈들:
|
|
||||||
|
|
||||||
* [app](api/app-ko.md)
|
|
||||||
* [auto-updater](api/auto-updater-ko.md)
|
|
||||||
* [browser-window](api/browser-window-ko.md)
|
|
||||||
* [content-tracing](api/content-tracing-ko.md)
|
|
||||||
* [dialog](api/dialog-ko.md)
|
|
||||||
* [global-shortcut](api/global-shortcut-ko.md)
|
|
||||||
* [ipc (main process)](api/ipc-main-process-ko.md)
|
|
||||||
* [menu](api/menu-ko.md)
|
|
||||||
* [menu-item](api/menu-item-ko.md)
|
|
||||||
* [power-monitor](api/power-monitor-ko.md)
|
|
||||||
* [power-save-blocker](api/power-save-blocker-ko.md)
|
|
||||||
* [protocol](api/protocol-ko.md)
|
|
||||||
* [tray](api/tray-ko.md)
|
|
||||||
|
|
||||||
랜더러 프로세스를 위한 모듈들 (웹 페이지):
|
|
||||||
|
|
||||||
* [ipc (renderer)](api/ipc-renderer-ko.md)
|
|
||||||
* [remote](api/remote-ko.md)
|
|
||||||
* [web-frame](api/web-frame-ko.md)
|
|
||||||
|
|
||||||
두 프로세스에서 모두 사용 가능한 모듈들:
|
|
||||||
|
|
||||||
* [clipboard](api/clipboard-ko.md)
|
|
||||||
* [crash-reporter](api/crash-reporter-ko.md)
|
|
||||||
* [native-image](api/native-image-ko.md)
|
|
||||||
* [screen](api/screen-ko.md)
|
|
||||||
* [shell](api/shell-ko.md)
|
|
||||||
|
|
||||||
## 개발자용
|
|
||||||
|
|
||||||
* [코딩 스타일](development/coding-style-ko.md)
|
|
||||||
* [소스 코드 디렉터리 구조](development/source-code-directory-structure-ko.md)
|
|
||||||
* [NW.js와 기술적으로 다른점 (이전 node-webkit)](development/atom-shell-vs-node-webkit-ko.md)
|
|
||||||
* [빌드 시스템 개요](development/build-system-overview-ko.md)
|
|
||||||
* [빌드 설명서 (Mac)](development/build-instructions-mac-ko.md)
|
|
||||||
* [빌드 설명서 (Windows)](development/build-instructions-windows-ko.md)
|
|
||||||
* [빌드 설명서 (Linux)](development/build-instructions-linux-ko.md)
|
|
||||||
* [디버거에서 디버그 심볼 서버 설정](development/setting-up-symbol-server-ko.md)
|
|
68
docs-translations/ko/README.md
Normal file
68
docs-translations/ko/README.md
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
## 개발 가이드
|
||||||
|
|
||||||
|
* [어플리케이션 배포](tutorial/application-distribution.md)
|
||||||
|
* [어플리케이션 패키징](tutorial/application-packaging.md)
|
||||||
|
* [네이티브 node 모듈 사용하기](tutorial/using-native-node-modules.md)
|
||||||
|
* [메인 프로세스 디버깅하기](tutorial/debugging-main-process.md)
|
||||||
|
* [Selenium 과 WebDriver 사용하기](tutorial/using-selenium-and-webdriver.md)
|
||||||
|
* [개발자 콘솔 확장기능](tutorial/devtools-extension.md)
|
||||||
|
* [Pepper 플래시 플러그인 사용하기](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)
|
||||||
|
* [크롬 Command-Line 스위치 지원](api/chrome-command-line-switches.md)
|
||||||
|
|
||||||
|
커스텀 DOM Element:
|
||||||
|
|
||||||
|
* [`File` 객체](api/file-object.md)
|
||||||
|
* [`<webview>` 태그](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)
|
||||||
|
* [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)
|
||||||
|
* [디버거에서 디버그 심볼 서버 설정](development/setting-up-symbol-server.md)
|
|
@ -62,9 +62,9 @@ Hostname 맵핑 규칙을 설정합니다. (`,`로 분리)
|
||||||
|
|
||||||
`--host-rules` 플래그와 비슷하지만 이 플래그는 host resolver에만 적용됩니다.
|
`--host-rules` 플래그와 비슷하지만 이 플래그는 host resolver에만 적용됩니다.
|
||||||
|
|
||||||
[app]: app-ko.md
|
[app]: app.md
|
||||||
[append-switch]: app-ko.md#appcommandlineappendswitchswitch-value
|
[append-switch]: app.md#appcommandlineappendswitchswitch-value
|
||||||
[ready]: app-ko.md#event-ready
|
[ready]: app.md#event-ready
|
||||||
|
|
||||||
## --ignore-certificate-errors
|
## --ignore-certificate-errors
|
||||||
|
|
|
@ -45,11 +45,11 @@ console.log(clipboard.readText('selection'));
|
||||||
|
|
||||||
* `type` String
|
* `type` String
|
||||||
|
|
||||||
클립보드로부터 [NativeImage](native-image-ko.md)로 이미지를 읽어들입니다.
|
클립보드로부터 [NativeImage](native-image.md)로 이미지를 읽어들입니다.
|
||||||
|
|
||||||
## clipboard.writeImage(image[, type])
|
## clipboard.writeImage(image[, type])
|
||||||
|
|
||||||
* `image` [NativeImage](native-image-ko.md)
|
* `image` [NativeImage](native-image.md)
|
||||||
* `type` String
|
* `type` String
|
||||||
|
|
||||||
클립보드에 `image`를 씁니다.
|
클립보드에 `image`를 씁니다.
|
|
@ -72,8 +72,8 @@ tracing.startRecording('*', tracing.DEFAULT_OPTIONS, function() {
|
||||||
|
|
||||||
Child 프로세스는 일반적으로 추적 데이터와 희귀한 플러시 그리고 추적 데이터를 메인 프로세스로 보내는 작업에 대해 캐싱 합니다.
|
Child 프로세스는 일반적으로 추적 데이터와 희귀한 플러시 그리고 추적 데이터를 메인 프로세스로 보내는 작업에 대해 캐싱 합니다.
|
||||||
이러한 일을 하는 이유는 IPC를 통해 추적 데이터를 보내는 작업은 매우 비싼 연산을 동반하기 때문입니다.
|
이러한 일을 하는 이유는 IPC를 통해 추적 데이터를 보내는 작업은 매우 비싼 연산을 동반하기 때문입니다.
|
||||||
우리는 추적에 의한 런타임 오버헤드를 피하는 것을 지향합니다.
|
우리는 추적에 의한 런타임 오버헤드를 피하고자 합니다.
|
||||||
그래서 트레이싱이 끝나면 모든 child 프로세스에 보류된 추적 데이터를 플러시 할 것인지 물어봅니다.
|
그래서 추적이 끝나면 모든 child 프로세스에 보류된 추적 데이터를 플러시 할 것인지 물어봅니다.
|
||||||
|
|
||||||
모든 child 프로세스가 `stopRecording` 요청을 받으면 `callback`에 추적 데이터를 포함한 파일을 전달됩니다.
|
모든 child 프로세스가 `stopRecording` 요청을 받으면 `callback`에 추적 데이터를 포함한 파일을 전달됩니다.
|
||||||
|
|
||||||
|
@ -107,21 +107,18 @@ Child 프로세스는 일반적으로 추적 데이터와 희귀한 플러시
|
||||||
|
|
||||||
현재 모니터링 추적 데이터를 가져옵니다.
|
현재 모니터링 추적 데이터를 가져옵니다.
|
||||||
|
|
||||||
Child processes typically are caching trace data and only rarely flush and send
|
자식 프로세스들은 일반적으로 추적 데이터를 캐싱하며 드물게 플러시 하거나 메인 프로세스로 추적 데이터를 보냅니다.
|
||||||
trace data back to the main process. That is because it may be an expensive
|
왜냐하면 IPC를 통해 추적 데이터를 보내는데에는 많은 자원을 소비하기 때문입니다.
|
||||||
operation to send the trace data over IPC, and we would like to avoid unneeded
|
그리고 우리는 추적시 발생하는 불필요한 런타임 오버헤드를 피하고자 합니다.
|
||||||
runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
|
그래서 추적이 끝나면 반드시 비동기로 자식 프로세스들의 보류된 추적 데이터를 플러시 할 것인지 물어봅니다.
|
||||||
child processes to flush any pending trace data.
|
|
||||||
|
|
||||||
Once all child processes have acked to the `captureMonitoringSnapshot` request,
|
모든 자식 프로세스가 `captureMonitoringSnapshot` 요청을 받으면 추적 데이터 파일을 포함하는 `callback`이 호출됩니다.
|
||||||
the `callback` will be invoked with a file that contains the traced data.
|
|
||||||
|
|
||||||
## tracing.getTraceBufferUsage(callback)
|
## tracing.getTraceBufferUsage(callback)
|
||||||
|
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
|
||||||
Get the maximum across processes of trace buffer percent full state. When the
|
추적 버퍼 % 전체 상태의 프로세스간 최대치를 가져옵니다. TraceBufferUsage 값이 결정되면 `callback`이 호출됩니다.
|
||||||
TraceBufferUsage value is determined, the `callback` is called.
|
|
||||||
|
|
||||||
## tracing.setWatchEvent(categoryName, eventName, callback)
|
## tracing.setWatchEvent(categoryName, eventName, callback)
|
||||||
|
|
||||||
|
@ -129,11 +126,8 @@ TraceBufferUsage value is determined, the `callback` is called.
|
||||||
* `eventName` String
|
* `eventName` String
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
|
||||||
`callback` will will be called every time the given event occurs on any
|
`callback`은 지정된 이벤트가 어떤 작업을 발생시킬 때마다 호출됩니다.
|
||||||
process.
|
|
||||||
|
|
||||||
## tracing.cancelWatchEvent()
|
## tracing.cancelWatchEvent()
|
||||||
|
|
||||||
Watch 이벤트를 중단합니다. 만약 추적이 활성화되어 있다면 이 함수는 watch 이벤트 콜백과 race가 일어날 것입니다.
|
Watch 이벤트를 중단합니다. 만약 추적이 활성화되어 있다면 이 함수는 watch 이벤트 콜백과 race가 일어날 것입니다.
|
||||||
|
|
||||||
Cancel the watch event. If tracing is enabled, this may race with the watch event callback.
|
|
|
@ -35,11 +35,16 @@ console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', '
|
||||||
filters: [
|
filters: [
|
||||||
{ name: 'Images', extensions: ['jpg', 'png', 'gif'] },
|
{ name: 'Images', extensions: ['jpg', 'png', 'gif'] },
|
||||||
{ name: 'Movies', extensions: ['mkv', 'avi', 'mp4'] },
|
{ name: 'Movies', extensions: ['mkv', 'avi', 'mp4'] },
|
||||||
{ name: 'Custom File Type', extensions: ['as'] }
|
{ name: 'Custom File Type', extensions: ['as'] },
|
||||||
|
{ name: 'All Files', extensions: ['*'] }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`extensions` 배열은 반드시 와일드카드와 마침표를 제외한 파일 확장자를 포함시켜야 합니다.
|
||||||
|
예를 들어 `'png'`는 가능하지만 `'.png'`와 `'*.png'`는 안됩니다.
|
||||||
|
모든 파일을 보여주려면 `'*'`와 같은 와일드카드를 사용하면 됩니다. (다른 와일드카드는 지원하지 않습니다)
|
||||||
|
|
||||||
`callback`이 전달되면 메소드가 비동기로 작동되며 결과는 `callback(filenames)`을 통해 전달됩니다.
|
`callback`이 전달되면 메소드가 비동기로 작동되며 결과는 `callback(filenames)`을 통해 전달됩니다.
|
||||||
|
|
||||||
Windows와 Linux에선 파일 선택 모드, 디렉터리 선택 모드를 동시에 사용할 수 없습니다.
|
Windows와 Linux에선 파일 선택 모드, 디렉터리 선택 모드를 동시에 사용할 수 없습니다.
|
||||||
|
@ -72,7 +77,7 @@ Windows와 Linux에선 파일 선택 모드, 디렉터리 선택 모드를 동
|
||||||
* `title` String - 대화 상자의 제목입니다. 몇몇 플랫폼에선 보이지 않을 수 있습니다.
|
* `title` String - 대화 상자의 제목입니다. 몇몇 플랫폼에선 보이지 않을 수 있습니다.
|
||||||
* `message` String - 대화 상자의 본문 내용입니다.
|
* `message` String - 대화 상자의 본문 내용입니다.
|
||||||
* `detail` String - 메시지의 추가 정보입니다.
|
* `detail` String - 메시지의 추가 정보입니다.
|
||||||
* `icon` [NativeImage](native-image-ko.md)
|
* `icon` [NativeImage](native-image.md)
|
||||||
* `cancelId` Integer - 유저가 대화 상자의 버튼을 클릭하지 않고 대화 상자를 취소했을 때 반환되는 버튼의 index입니다.
|
* `cancelId` Integer - 유저가 대화 상자의 버튼을 클릭하지 않고 대화 상자를 취소했을 때 반환되는 버튼의 index입니다.
|
||||||
기본적으로 버튼 리스트가 "cancel" 또는 "no" 라벨을 가지고 있을 때 해당 버튼의 index를 반환합니다. 따로 두 라벨이 지정되지 않은 경우 0을 반환합니다.
|
기본적으로 버튼 리스트가 "cancel" 또는 "no" 라벨을 가지고 있을 때 해당 버튼의 index를 반환합니다. 따로 두 라벨이 지정되지 않은 경우 0을 반환합니다.
|
||||||
OS X와 Windows에선 `cancelId` 지정 여부에 상관없이 "Cancel" 버튼이 언제나 `cancelId`로 지정됩니다.
|
OS X와 Windows에선 `cancelId` 지정 여부에 상관없이 "Cancel" 버튼이 언제나 `cancelId`로 지정됩니다.
|
|
@ -4,7 +4,7 @@ Frameless 윈도우는 테두리가 없는 윈도우 창을 말합니다.
|
||||||
|
|
||||||
## Frameless 윈도우 만들기
|
## Frameless 윈도우 만들기
|
||||||
|
|
||||||
Frameless 윈도우를 만드려면 [BrowserWindow](browser-window-ko.md) 객체의 `options`에서 `frame` 옵션을 `false`로 지정하기만 하면됩니다:
|
Frameless 윈도우를 만드려면 [BrowserWindow](browser-window.md) 객체의 `options`에서 `frame` 옵션을 `false`로 지정하기만 하면됩니다:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var BrowserWindow = require('browser-window');
|
var BrowserWindow = require('browser-window');
|
|
@ -32,20 +32,20 @@ app.on('will-quit', function() {
|
||||||
|
|
||||||
## globalShortcut.register(accelerator, callback)
|
## globalShortcut.register(accelerator, callback)
|
||||||
|
|
||||||
* `accelerator` [Accelerator](accelerator-ko.md)
|
* `accelerator` [Accelerator](accelerator.md)
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
|
||||||
`accelerator`로 표현된 전역 단축키를 등록합니다. 유저로부터 등록된 단축키가 눌렸을 경우 `callback` 함수가 호출됩니다.
|
`accelerator`로 표현된 전역 단축키를 등록합니다. 유저로부터 등록된 단축키가 눌렸을 경우 `callback` 함수가 호출됩니다.
|
||||||
|
|
||||||
## globalShortcut.isRegistered(accelerator)
|
## globalShortcut.isRegistered(accelerator)
|
||||||
|
|
||||||
* `accelerator` [Accelerator](accelerator-ko.md)
|
* `accelerator` [Accelerator](accelerator.md)
|
||||||
|
|
||||||
지정된 `accelerator` 단축키가 등록되었는지 여부를 확인합니다. 반환값은 boolean(true, false) 입니다.
|
지정된 `accelerator` 단축키가 등록되었는지 여부를 확인합니다. 반환값은 boolean(true, false) 입니다.
|
||||||
|
|
||||||
## globalShortcut.unregister(accelerator)
|
## globalShortcut.unregister(accelerator)
|
||||||
|
|
||||||
* `accelerator` [Accelerator](accelerator-ko.md)
|
* `accelerator` [Accelerator](accelerator.md)
|
||||||
|
|
||||||
`키코드`에 해당하는 전역 단축키를 등록 해제합니다.
|
`키코드`에 해당하는 전역 단축키를 등록 해제합니다.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
동기 메시지는 `event.returnValue`를 이용하여 반환값(답장)을 설정할 수 있습니다. 비동기 메시지라면 `event.sender.send(...)`를 사용하면 됩니다.
|
동기 메시지는 `event.returnValue`를 이용하여 반환값(답장)을 설정할 수 있습니다. 비동기 메시지라면 `event.sender.send(...)`를 사용하면 됩니다.
|
||||||
|
|
||||||
또한 메인 프로세스에서 랜더러 프로세스로 메시지를 보내는 것도 가능합니다.
|
또한 메인 프로세스에서 랜더러 프로세스로 메시지를 보내는 것도 가능합니다.
|
||||||
자세한 내용은 [WebContents.send](browser-window-ko.md#webcontentssendchannel-args)를 참고 하세요.
|
자세한 내용은 [WebContents.send](browser-window.md#webcontentssendchannel-args)를 참고 하세요.
|
||||||
|
|
||||||
보내진 메시지들을 처리하는 예제입니다:
|
보내진 메시지들을 처리하는 예제입니다:
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# ipc (renderer)
|
# ipc (renderer)
|
||||||
|
|
||||||
`ipc` 모듈은 메인 프로세스로 메시지를 동기 또는 비동기로 보내고 받을 수 있는 몇 가지 방법을 제공합니다.
|
`ipc` 모듈은 메인 프로세스로 메시지를 동기 또는 비동기로 보내고 받을 수 있는 몇 가지 방법을 제공합니다.
|
||||||
만약 랜더러 프로세스에서 메인 프로세스의 모듈을 직접적으로 사용하고 싶다면 [remote](remote-ko.md) 모듈을 사용하는 것을 고려해보는 것이 좋습니다.
|
만약 랜더러 프로세스에서 메인 프로세스의 모듈을 직접적으로 사용하고 싶다면 [remote](remote.md) 모듈을 사용하는 것을 고려해보는 것이 좋습니다.
|
||||||
|
|
||||||
[ipc (main process)](ipc-main-process-ko.md)에서 예제를 볼 수 있습니다.
|
[ipc (main process)](ipc-main-process.md)에서 예제를 볼 수 있습니다.
|
||||||
|
|
||||||
## ipc.send(channel[, args...])
|
## ipc.send(channel[, args...])
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
* `type` String - `MenuItem`의 타입 `normal`, `separator`, `submenu`, `checkbox` 또는 `radio` 사용가능
|
* `type` String - `MenuItem`의 타입 `normal`, `separator`, `submenu`, `checkbox` 또는 `radio` 사용가능
|
||||||
* `label` String
|
* `label` String
|
||||||
* `sublabel` String
|
* `sublabel` String
|
||||||
* `accelerator` [Accelerator](accelerator-ko.md)
|
* `accelerator` [Accelerator](accelerator.md)
|
||||||
* `icon` [NativeImage](native-image-ko.md)
|
* `icon` [NativeImage](native-image.md)
|
||||||
* `enabled` Boolean
|
* `enabled` Boolean
|
||||||
* `visible` Boolean
|
* `visible` Boolean
|
||||||
* `checked` Boolean
|
* `checked` Boolean
|
|
@ -1,10 +1,11 @@
|
||||||
# menu
|
# menu
|
||||||
|
|
||||||
`Menu` 클래스는 어플리케이션 메뉴와 컨텍스트 메뉴를 만들 때 사용할 수 있습니다.
|
`Menu` 클래스는 어플리케이션 메뉴와 컨텍스트 메뉴를 만들 때 사용됩니다.
|
||||||
각 메뉴는 여러 개의 메뉴 아이템으로 구성되어 있으며 서브 메뉴를 가질 수도 있습니다.
|
메뉴는 여러 개의 메뉴 아이템으로 구성되고 서브 메뉴를 가질 수도 있습니다.
|
||||||
|
|
||||||
다음 예제는 웹 페이지 내에서 [remote](remote-ko.md) 모듈을 활용하여 동적으로 메뉴를 생성하는 예제입니다.
|
다음 예제는 웹 페이지 내에서 [remote](remote.md) 모듈을 활용하여 동적으로 메뉴를 생성하는 예제입니다.
|
||||||
그리고 이 예제에서 만들어진 메뉴는 유저가 페이지에서 오른쪽 클릭을 할 때 마우스 위치에 팝업으로 표시됩니다:
|
|
||||||
|
이 예제에서 만들어진 메뉴는 유저가 페이지에서 오른쪽 클릭을 할 때 마우스 위치에 팝업 형태로 표시됩니다:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
|
@ -27,7 +28,7 @@ window.addEventListener('contextmenu', function (e) {
|
||||||
|
|
||||||
다음 예제는 template API를 활용하여 어플리케이션 메뉴를 만드는 간단한 예제입니다:
|
다음 예제는 template API를 활용하여 어플리케이션 메뉴를 만드는 간단한 예제입니다:
|
||||||
|
|
||||||
**Windows 와 Linux 주의:** 각 메뉴 아이템의 `selector` 멤버는 Mac 운영체제 전용입니다. [Accelerator 옵션](https://github.com/atom/electron/blob/master/docs/api/accelerator-ko.md)
|
**Windows 와 Linux 유저 주의:** 각 메뉴 아이템의 `selector` 멤버는 Mac 운영체제 전용입니다. [Accelerator 옵션](accelerator.md)
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
|
@ -188,7 +189,7 @@ Menu.setApplicationMenu(menu);
|
||||||
|
|
||||||
* `template` Array
|
* `template` Array
|
||||||
|
|
||||||
기본적으로 `template`는 [MenuItem](menu-item-ko.md)을 생성할 때 사용하는 `options`의 배열입니다. 사용법은 위에서 설명한 것과 같습니다.
|
기본적으로 `template`는 [MenuItem](menu-item.md)을 생성할 때 사용하는 `options`의 배열입니다. 사용법은 위에서 설명한 것과 같습니다.
|
||||||
|
|
||||||
또한 `template`에는 다른 속성도 추가할 수 있으며 메뉴가 만들어질 때 해당 메뉴 아이템의 프로퍼티로 변환됩니다.
|
또한 `template`에는 다른 속성도 추가할 수 있으며 메뉴가 만들어질 때 해당 메뉴 아이템의 프로퍼티로 변환됩니다.
|
||||||
|
|
|
@ -21,6 +21,8 @@ var appIcon = new Tray(image);
|
||||||
|
|
||||||
현재 `PNG` 와 `JPEG` 포맷을 지원하고 있습니다. 손실 없는 이미지 압축과 투명도 지원을 위해 `PNG` 사용을 권장합니다.
|
현재 `PNG` 와 `JPEG` 포맷을 지원하고 있습니다. 손실 없는 이미지 압축과 투명도 지원을 위해 `PNG` 사용을 권장합니다.
|
||||||
|
|
||||||
|
그리고 Windows에서는 `ICO` 포맷도 사용할 수 있습니다.
|
||||||
|
|
||||||
## 고해상도 이미지
|
## 고해상도 이미지
|
||||||
|
|
||||||
플랫폼이 high-DPI를 지원하는 경우 `@2x`와 같이 이미지의 파일명 뒤에 접미사를 추가하여 고해상도 이미지로 지정할 수 있습니다.
|
플랫폼이 high-DPI를 지원하는 경우 `@2x`와 같이 이미지의 파일명 뒤에 접미사를 추가하여 고해상도 이미지로 지정할 수 있습니다.
|
|
@ -1,131 +0,0 @@
|
||||||
# protocol
|
|
||||||
|
|
||||||
`protocol` 모듈은 여러 프로토콜의 요청과 응답을 커스터마이즈 할 수 있도록 이미 있는 프로토콜을 변경하거나 새로운 프로토콜을 만드는 방법을 제공합니다.
|
|
||||||
|
|
||||||
다음 예제는 `file://` 프로토콜과 같은 일을 하는 커스텀 프로토콜을 설정합니다:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var app = require('app');
|
|
||||||
var path = require('path');
|
|
||||||
|
|
||||||
app.on('ready', function() {
|
|
||||||
var protocol = require('protocol');
|
|
||||||
protocol.registerProtocol('atom', function(request) {
|
|
||||||
var url = request.url.substr(7)
|
|
||||||
return new protocol.RequestFileJob(path.normalize(__dirname + '/' + url));
|
|
||||||
}, function (error, scheme) {
|
|
||||||
if (!error)
|
|
||||||
console.log(scheme, ' registered successfully')
|
|
||||||
});
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
**알림:** 이 모듈은 app의 `ready` 이벤트가 발생한 이후에만 사용할 수 있습니다.
|
|
||||||
|
|
||||||
## protocol.registerProtocol(scheme, handler, callback)
|
|
||||||
|
|
||||||
* `scheme` String
|
|
||||||
* `handler` Function
|
|
||||||
* `callback` Function
|
|
||||||
|
|
||||||
지정한 `scheme`을 기반으로 커스텀 프로토콜을 등록합니다. `handler`는 등록한 `scheme` 프로토콜에 요청이 들어올 경우 `request` 인자와 함께 `handler(request)` 형식으로 호출됩니다.
|
|
||||||
|
|
||||||
`handler` 함수에선 요청에 대한 해당 프로토콜의 작업 결과를 응답(반환) 해야 합니다.
|
|
||||||
|
|
||||||
기본적으로 스킴은 `http:`와 비슷합니다. `file:`과 같이 "표준 URI 구문"을 다르게 해석되게 하려면
|
|
||||||
`protocol.registerStandardSchemes` 메서드를 이용해서 사용자 정의 스킴을 표준 스킴으로 만들 수 있습니다.
|
|
||||||
|
|
||||||
## protocol.unregisterProtocol(scheme, callback)
|
|
||||||
|
|
||||||
* `scheme` String
|
|
||||||
* `callback` Function
|
|
||||||
|
|
||||||
지정한 `scheme` 프로토콜을 등록 해제합니다.
|
|
||||||
|
|
||||||
## protocol.registerStandardSchemes(value)
|
|
||||||
|
|
||||||
* `value` Array
|
|
||||||
|
|
||||||
지정한 `value` 배열을 사용하여 미리 지정된 표준 스킴으로 등록합니다.
|
|
||||||
|
|
||||||
표준 스킴은 RFC 3986 [표준 URI 구문](https://tools.ietf.org/html/rfc3986#section-3)에 해당합니다.
|
|
||||||
이 표준은 `file:`과 `filesystem:`을 포함합니다.
|
|
||||||
|
|
||||||
## protocol.isHandledProtocol(scheme, callback)
|
|
||||||
|
|
||||||
* `scheme` String
|
|
||||||
* `callback` Function
|
|
||||||
|
|
||||||
해당 `scheme`에 처리자(handler)가 등록되었는지 확인합니다.
|
|
||||||
지정한 `callback`에 결과가 boolean 값으로 반환됩니다.
|
|
||||||
|
|
||||||
## protocol.interceptProtocol(scheme, handler, callback)
|
|
||||||
|
|
||||||
* `scheme` String
|
|
||||||
* `handler` Function
|
|
||||||
* `callback` Function
|
|
||||||
|
|
||||||
지정한 `scheme`의 작업을 `handler`로 변경합니다.
|
|
||||||
`handler`에서 `null` 또는 `undefined`를 반환 할 경우 해당 프로토콜의 기본 동작(응답)으로 대체 됩니다.
|
|
||||||
|
|
||||||
## protocol.uninterceptProtocol(scheme, callback)
|
|
||||||
|
|
||||||
* `scheme` String
|
|
||||||
* `callback` Function
|
|
||||||
|
|
||||||
변경된 프로토콜의 작업을 해제합니다.
|
|
||||||
|
|
||||||
## Class: protocol.RequestFileJob(path)
|
|
||||||
|
|
||||||
* `path` String
|
|
||||||
|
|
||||||
`path` 경로를 기반으로 파일을 반환하는 request 작업을 생성합니다. 그리고 해당 파일에 상응하는 mime type을 지정합니다.
|
|
||||||
|
|
||||||
## Class: protocol.RequestStringJob(options)
|
|
||||||
|
|
||||||
* `options` Object
|
|
||||||
* `mimeType` String - 기본값: `text/plain`
|
|
||||||
* `charset` String - 기본값: `UTF-8`
|
|
||||||
* `data` String
|
|
||||||
|
|
||||||
문자열을 반환하는 request 작업을 생성합니다.
|
|
||||||
|
|
||||||
## Class: protocol.RequestBufferJob(options)
|
|
||||||
|
|
||||||
* `options` Object
|
|
||||||
* `mimeType` String - 기본값: `application/octet-stream`
|
|
||||||
* `encoding` String - 기본값: `UTF-8`
|
|
||||||
* `data` Buffer
|
|
||||||
|
|
||||||
버퍼를 반환하는 request 작업을 생성합니다.
|
|
||||||
|
|
||||||
## Class: protocol.RequestHttpJob(options)
|
|
||||||
|
|
||||||
* `options` Object
|
|
||||||
* `session` [Session](browser-window.md#class-session) - 기본적으로 이 옵션은 어플리케이션의 기본 세션입니다.
|
|
||||||
`null`로 설정하면 요청을 위한 새로운 세션을 만듭니다.
|
|
||||||
* `url` String
|
|
||||||
* `method` String - 기본값: `GET`
|
|
||||||
* `referrer` String
|
|
||||||
|
|
||||||
`url`의 요청 결과를 그대로 반환하는 request 작업을 생성합니다.
|
|
||||||
|
|
||||||
## Class: protocol.RequestErrorJob(code)
|
|
||||||
|
|
||||||
* `code` Integer
|
|
||||||
|
|
||||||
콘솔에 특정한 네트워크 에러 메시지를 설정하는 request 작업을 생성합니다.
|
|
||||||
기본 메시지는 `net::ERR_NOT_IMPLEMENTED`입니다. 사용할 수 있는 코드의 범위는 다음과 같습니다.
|
|
||||||
|
|
||||||
* 범위:
|
|
||||||
* 0- 99 System related errors
|
|
||||||
* 100-199 Connection related errors
|
|
||||||
* 200-299 Certificate errors
|
|
||||||
* 300-399 HTTP errors
|
|
||||||
* 400-499 Cache errors
|
|
||||||
* 500-599 ?
|
|
||||||
* 600-699 FTP errors
|
|
||||||
* 700-799 Certificate manager errors
|
|
||||||
* 800-899 DNS resolver errors
|
|
||||||
|
|
||||||
에러 코드와 메시지에 대해 자세하게 알아보려면 [네트워크 에러 리스트](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h)를 참고하기 바랍니다.
|
|
145
docs-translations/ko/api/protocol.md
Normal file
145
docs-translations/ko/api/protocol.md
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
# protocol
|
||||||
|
|
||||||
|
`protocol` 모듈은 이미 있는 프로토콜의 동작을 가로채거나 새로운 프로토콜을 만들 수 있는 기능을 제공합니다.
|
||||||
|
|
||||||
|
다음 예제는 `file://` 프로토콜과 같은 일을 하는 커스텀 프로토콜을 설정합니다:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var app = require('app');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
app.on('ready', function() {
|
||||||
|
var protocol = require('protocol');
|
||||||
|
protocol.registerFileProtocol('atom', function(request, callback) {
|
||||||
|
var url = request.url.substr(7);
|
||||||
|
callback({path: path.normalize(__dirname + '/' + url)});
|
||||||
|
}, function (error) {
|
||||||
|
if (error)
|
||||||
|
console.error('Failed to register protocol')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**알림:** 이 모듈은 `ready` 이벤트가 호출된 이후에만 사용할 수 있습니다.
|
||||||
|
|
||||||
|
## protocol.registerStandardSchemes(schemes)
|
||||||
|
|
||||||
|
* `schemes` Array - 표준 스킴으로 등록할 커스텀 스킴 리스트
|
||||||
|
|
||||||
|
표준 스킴의 형식은 RFC 3986 [일반 URI 구문](https://tools.ietf.org/html/rfc3986#section-3) 표준을 따릅니다.
|
||||||
|
이 형식은 `file:`과 `filesystem:`을 포함합니다.
|
||||||
|
|
||||||
|
## protocol.registerFileProtocol(scheme, handler[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `handler` Function
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
`scheme`에 파일을 응답으로 보내는 프로토콜을 등록합니다.
|
||||||
|
`handler`는 `request`가 `scheme`와 함께 생성될 때 `handler(request, callback)` 형식으로 호출됩니다.
|
||||||
|
`completion`은 `scheme`가 성공적으로 등록되었을 때 `completion(null)` 형식으로 호출되고
|
||||||
|
등록에 실패했을 땐 `completion(error)` 형식으로 에러 내용을 담아 호출됩니다.
|
||||||
|
|
||||||
|
`request`를 처리할 때 반드시 파일 경로 또는 `path` 속성을 포함하는 객체를 인자에 포함하여 `callback`을 호출해야 합니다.
|
||||||
|
예: `callback(filePath)` 또는 `callback({path: filePath})`.
|
||||||
|
|
||||||
|
만약 `callback`이 아무 인자도 없이 호출되거나 숫자나 `error` 프로퍼티를 가진 객체가 인자로 전달될 경우
|
||||||
|
`request`는 지정한 `error` 코드(숫자)를 출력합니다.
|
||||||
|
사용할 수 있는 에러 코드는 다음 링크에서 확인할 수 있습니다: https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h
|
||||||
|
|
||||||
|
기본적으로 스킴은 `http:`와 같이 처리됩니다. `file:`과 같이 "일반적인 URI 문법"과는 다르게 인식되는 프로토콜은
|
||||||
|
`protocol.registerStandardSchemes`을 사용하여 표준 스킴으로 처리되도록 할 수 있습니다.
|
||||||
|
|
||||||
|
## protocol.registerBufferProtocol(scheme, handler[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `handler` Function
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
`scheme`에 `Buffer`를 응답으로 보내는 프로토콜을 등록합니다.
|
||||||
|
반드시 `Buffer` 또는 `data`, `mimeType`, `chart` 속성을 포함한 객체 중 하나를 인자에 포함하여 `callback`을 호출해야 합니다.
|
||||||
|
|
||||||
|
예제:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
protocol.registerBufferProtocol('atom', function(request, callback) {
|
||||||
|
callback({mimeType: 'text/html', data: new Buffer('<h5>Response</h5>')});
|
||||||
|
}, function (error) {
|
||||||
|
if (error)
|
||||||
|
console.error('Failed to register protocol')
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## protocol.registerStringProtocol(scheme, handler[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `handler` Function
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
`scheme`에 `문자열`를 응답으로 보내는 프로토콜을 등록합니다.
|
||||||
|
반드시 `문자열` 또는 `data`, `mimeType`, `chart` 속성을 포함한 객체 중 하나를 인자에 포함하여 `callback`을 호출해야 합니다.
|
||||||
|
|
||||||
|
## protocol.registerHttpProtocol(scheme, handler[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `handler` Function
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
|
||||||
|
`scheme`에 HTTP 요청을 응답으로 보내는 프로토콜을 등록합니다.
|
||||||
|
반드시 `url`, `method`, `referer`, `session` 속성을 포함하는 객체를 인자에 포함하여 `callback`을 호출해야 합니다.
|
||||||
|
|
||||||
|
기본적으로 HTTP 요청은 현재 세션을 재사용합니다. 만약 서로 다른 세션에 요청을 보내고 싶으면 `session`을 `null`로 지정해야 합니다.
|
||||||
|
|
||||||
|
## protocol.unregisterProtocol(scheme[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
`scheme`의 커스텀 프로토콜 등록을 해제합니다.
|
||||||
|
|
||||||
|
## protocol.isProtocolHandled(scheme, callback)
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `callback` Function
|
||||||
|
|
||||||
|
`scheme`에 동작(handler)이 등록되어 있는지 여부를 확인합니다. `callback`으로 결과(boolean)가 반환됩니다.
|
||||||
|
|
||||||
|
## protocol.interceptFileProtocol(scheme, handler[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `handler` Function
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
`scheme` 프로토콜을 가로채고 `handler`를 파일 전송에 대한 새로운 동작으로 사용합니다.
|
||||||
|
|
||||||
|
## protocol.interceptStringProtocol(scheme, handler[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `handler` Function
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
`scheme` 프로토콜을 가로채고 `handler`를 문자열 전송에 대한 새로운 동작으로 사용합니다.
|
||||||
|
|
||||||
|
## protocol.interceptBufferProtocol(scheme, handler[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `handler` Function
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
`scheme` 프로토콜을 가로채고 `handler`를 `Buffer` 전송에 대한 새로운 동작으로 사용합니다.
|
||||||
|
|
||||||
|
## protocol.interceptHttpProtocol(scheme, handler[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `handler` Function
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
`scheme` 프로토콜을 가로채고 `handler`를 HTTP 프로토콜의 요청에 대한 새로운 동작으로 사용합니다.
|
||||||
|
|
||||||
|
## protocol.uninterceptProtocol(scheme[, completion])
|
||||||
|
|
||||||
|
* `scheme` String
|
||||||
|
* `completion` Function
|
||||||
|
|
||||||
|
가로챈 `scheme`를 삭제하고 기본 핸들러로 복구합니다.
|
|
@ -70,7 +70,7 @@ remote.getCurrentWindow().on('close', function() {
|
||||||
|
|
||||||
## remote.getCurrentWindow()
|
## remote.getCurrentWindow()
|
||||||
|
|
||||||
현재 웹 페이지가 들어있는 [BrowserWindow](browser-window-ko.md) 객체를 반환합니다.
|
현재 웹 페이지가 들어있는 [BrowserWindow](browser-window.md) 객체를 반환합니다.
|
||||||
|
|
||||||
## remote.getCurrentWebContents()
|
## remote.getCurrentWebContents()
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# 개요
|
# 개요
|
||||||
|
|
||||||
Electron은 모든 [node.js's built-in 모듈](http://nodejs.org/api/)과 third-party node 모듈을 완벽하게 지원합니다. ([네이티브 모듈](../tutorial/using-native-node-modules-ko.md)을 포함해서)
|
Electron은 모든 [node.js's built-in 모듈](http://nodejs.org/api/)과 third-party node 모듈을 완벽하게 지원합니다. ([네이티브 모듈](../tutorial/using-native-node-modules.md)을 포함해서)
|
||||||
|
|
||||||
Electron은 네이티브 데스크톱 어플리케이션을 개발 할 수 있도록 추가적인 built-in 모듈을 제공합니다.
|
Electron은 네이티브 데스크톱 어플리케이션을 개발 할 수 있도록 추가적인 built-in 모듈을 제공합니다.
|
||||||
몇몇 모듈은 메인 프로세스에서만 사용할 수 있고 어떤 모듈은 랜더러 프로세스에서만 사용할 수 있습니다. 또한 두 프로세스 모두 사용할 수 있는 모듈도 있습니다.
|
몇몇 모듈은 메인 프로세스에서만 사용할 수 있고 어떤 모듈은 랜더러 프로세스에서만 사용할 수 있습니다. 또한 두 프로세스 모두 사용할 수 있는 모듈도 있습니다.
|
||||||
기본적인 규칙은 다음과 같습니다: GUI와 저 수준 시스템에 관련된 모듈은 오직 메인 프로세스에서만 사용할 수 있습니다.
|
기본적인 규칙은 다음과 같습니다: GUI와 저 수준 시스템에 관련된 모듈은 오직 메인 프로세스에서만 사용할 수 있습니다.
|
||||||
[메인 프로세스 vs. 랜더러 프로세스](../tutorial/quick-start-ko.md#메인 프로세스) 컨셉에 익숙해야 이 모듈들을 사용하기 쉬우므로 해당 문서를 정독하는 것을 권장합니다.
|
[메인 프로세스 vs. 랜더러 프로세스](../tutorial/quick-start.md#메인 프로세스) 컨셉에 익숙해야 이 모듈들을 사용하기 쉬우므로 해당 문서를 정독하는 것을 권장합니다.
|
||||||
|
|
||||||
|
|
||||||
메인 프로세스 스크립트는 일반 `node.js` 스크립트와 같습니다:
|
메인 프로세스 스크립트는 일반 `node.js` 스크립트와 같습니다:
|
||||||
|
@ -36,4 +36,4 @@ app.on('ready', function() {
|
||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
어플리케이션을 실행하려면 [앱 실행하기](../tutorial/quick-start-ko.md#앱 실행하기) 문서를 참고하기 바랍니다.
|
어플리케이션을 실행하려면 [앱 실행하기](../tutorial/quick-start.md#앱 실행하기) 문서를 참고하기 바랍니다.
|
|
@ -38,7 +38,7 @@ __플랫폼별 한계:__
|
||||||
|
|
||||||
### new Tray(image)
|
### new Tray(image)
|
||||||
|
|
||||||
* `image` [NativeImage](native-image-ko.md)
|
* `image` [NativeImage](native-image.md)
|
||||||
|
|
||||||
전달된 `image`를 이용하여 트레이 아이콘을 만듭니다.
|
전달된 `image`를 이용하여 트레이 아이콘을 만듭니다.
|
||||||
|
|
||||||
|
@ -126,13 +126,13 @@ __주의:__ 이 기능은 OS X에서만 작동합니다.
|
||||||
|
|
||||||
### Tray.setImage(image)
|
### Tray.setImage(image)
|
||||||
|
|
||||||
* `image` [NativeImage](native-image-ko.md)
|
* `image` [NativeImage](native-image.md)
|
||||||
|
|
||||||
`image`를 사용하여 트레이 아이콘의 이미지를 설정합니다.
|
`image`를 사용하여 트레이 아이콘의 이미지를 설정합니다.
|
||||||
|
|
||||||
### Tray.setPressedImage(image)
|
### Tray.setPressedImage(image)
|
||||||
|
|
||||||
* `image` [NativeImage](native-image-ko.md)
|
* `image` [NativeImage](native-image.md)
|
||||||
|
|
||||||
`image`를 사용하여 트레이 아이콘이 눌렸을 때의 이미지를 설정합니다.
|
`image`를 사용하여 트레이 아이콘이 눌렸을 때의 이미지를 설정합니다.
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ __주의:__ 이 기능은 OS X에서만 작동합니다.
|
||||||
### Tray.displayBalloon(options)
|
### Tray.displayBalloon(options)
|
||||||
|
|
||||||
* `options` Object
|
* `options` Object
|
||||||
* `icon` [NativeImage](native-image-ko.md)
|
* `icon` [NativeImage](native-image.md)
|
||||||
* `title` String
|
* `title` String
|
||||||
* `content` String
|
* `content` String
|
||||||
|
|
|
@ -311,7 +311,7 @@ Webview 페이지를 PDF 형식으로 인쇄합니다. `webContents.printToPDF(o
|
||||||
`channel`을 통해 게스트 페이지에 `args...` 비동기 메시지를 보냅니다.
|
`channel`을 통해 게스트 페이지에 `args...` 비동기 메시지를 보냅니다.
|
||||||
게스트 페이지에선 `ipc` 모듈의 `channel` 이벤트를 사용하면 이 메시지를 받을 수 있습니다.
|
게스트 페이지에선 `ipc` 모듈의 `channel` 이벤트를 사용하면 이 메시지를 받을 수 있습니다.
|
||||||
|
|
||||||
예제는 [WebContents.send](browser-window-ko.md#webcontentssendchannel-args)를 참고하세요.
|
예제는 [WebContents.send](browser-window.md#webcontentssendchannel-args)를 참고하세요.
|
||||||
|
|
||||||
## DOM 이벤트
|
## DOM 이벤트
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 어플리케이션 배포
|
# 어플리케이션 배포
|
||||||
|
|
||||||
Electron 어플리케이션을 배포할 때는 어플리케이션 폴더의 이름을 `app`으로 지정한 후 Electron 실행파일의 리소스 디렉터리에 집어넣어야합니다.
|
Electron 어플리케이션을 배포하려면 어플리케이션 폴더 이름을 `app`으로 지정한 후 Electron 실행파일의 리소스 디렉터리에 집어넣기만 하면 됩니다.
|
||||||
리소스 디렉터리는 OS X에선 `Electron.app/Contents/Resources/` Windows와 Linux에선 `resources/` 입니다.
|
리소스 디렉터리는 OS X에선 `Electron.app/Contents/Resources/` Windows와 Linux에선 `resources/` 입니다.
|
||||||
|
|
||||||
예제:
|
예제:
|
||||||
|
@ -23,8 +23,8 @@ electron/resources/app
|
||||||
└── index.html
|
└── index.html
|
||||||
```
|
```
|
||||||
|
|
||||||
그리고 `Electron.app`을 실행하면(Linux에선 `electron` Windows에선 `electron.exe`입니다) Electron은 해당 앱을 실행시킵니다.
|
그리고 `Electron.app`을 실행하면(Linux에선 `electron` Windows에선 `electron.exe`입니다) Electron 앱이 실행시킵니다.
|
||||||
최종 사용자에게는 이 `electron` 폴더(Electron.app)를 배포하면 됩니다.
|
최종 사용자에겐 이 `electron` 폴더(Electron.app)를 배포하면 됩니다.
|
||||||
|
|
||||||
## asar로 앱 패키징 하기
|
## asar로 앱 패키징 하기
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ electron/resources/
|
||||||
└── app.asar
|
└── app.asar
|
||||||
```
|
```
|
||||||
|
|
||||||
자세한 내용은 [어플리케이션 패키징](application-packaging-ko.md)에서 찾아볼 수 있습니다.
|
자세한 내용은 [어플리케이션 패키징](application-packaging.md)에서 찾아볼 수 있습니다.
|
||||||
|
|
||||||
## 다운로드한 바이너리의 리소스를 앱에 맞게 수정하기
|
## 다운로드한 바이너리의 리소스를 앱에 맞게 수정하기
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ MyApp.app/Contents
|
||||||
|
|
||||||
### 역주-자동화
|
### 역주-자동화
|
||||||
|
|
||||||
배포시에 Electron의 리소스를 일일이 수정하는 것은 매우 귀찮고 복잡합니다.
|
어플리케이션 배포시 Electron의 리소스를 일일이 수정하는 것은 매우 귀찮고 복잡합니다.
|
||||||
하지만 이 작업을 자동화 시킬 수 있는 몇가지 방법이 있습니다:
|
하지만 이 작업을 자동화 시킬 수 있는 몇가지 방법이 있습니다:
|
||||||
|
|
||||||
* [electron-builder](https://github.com/loopline-systems/electron-builder)
|
* [electron-builder](https://github.com/loopline-systems/electron-builder)
|
||||||
|
@ -110,6 +110,7 @@ MyApp.app/Contents
|
||||||
## Electron 소스코드를 다시 빌드하여 리소스 수정하기
|
## Electron 소스코드를 다시 빌드하여 리소스 수정하기
|
||||||
|
|
||||||
또한 Electron 소스코드를 다시 빌드할 때 어플리케이션 이름을 변경할 수 있습니다.
|
또한 Electron 소스코드를 다시 빌드할 때 어플리케이션 이름을 변경할 수 있습니다.
|
||||||
|
|
||||||
`GYP_DEFINES` 환경변수를 사용하여 다음과 같이 다시 빌드할 수 있습니다:
|
`GYP_DEFINES` 환경변수를 사용하여 다음과 같이 다시 빌드할 수 있습니다:
|
||||||
|
|
||||||
__Windows__
|
__Windows__
|
||||||
|
@ -133,6 +134,6 @@ $ script/build.py -c Release -t myapp
|
||||||
### grunt-build-atom-shell
|
### grunt-build-atom-shell
|
||||||
|
|
||||||
Electron의 소스코드를 수정하고 다시 빌드하는 작업은 상당히 복잡합니다.
|
Electron의 소스코드를 수정하고 다시 빌드하는 작업은 상당히 복잡합니다.
|
||||||
이를 해결하기 위해 [grunt-build-atom-shell](https://github.com/paulcbetts/grunt-build-atom-shell)를 사용하여 빌드를 자동화 시킬 수 있습니다.
|
일일이 소스코드를 수정하는 대신 [grunt-build-atom-shell](https://github.com/paulcbetts/grunt-build-atom-shell)을 사용하여 빌드를 자동화 시킬 수 있습니다.
|
||||||
|
|
||||||
이 툴을 사용하면 자동으로 `.gyp`파일을 수정하고 다시 빌드합니다. 그리고 어플리케이션의 네이티브 Node 모듈 또한 새로운 실행파일 이름으로 매치 시킵니다.
|
이 툴을 사용하면 자동으로 `.gyp`파일을 수정하고 다시 빌드합니다. 그리고 어플리케이션의 네이티브 Node 모듈 또한 새로운 실행파일 이름으로 매치 시킵니다.
|
|
@ -1,11 +1,11 @@
|
||||||
# 어플리케이션 패키징
|
# 어플리케이션 패키징
|
||||||
|
|
||||||
Windows에서 일어나는 긴 경로 이름에 대한 [issues](https://github.com/joyent/node/issues/6960)를 완화하고 `require` 속도를 약간 빠르게 하며
|
Windows에서 일어나는 긴 경로 이름에 대한 [issues](https://github.com/joyent/node/issues/6960)를 완화하고 `require` 속도를 약간 빠르게 하며
|
||||||
어플리케이션의 리소스와 소스코드를 유저로부터 보호하기 위해 어플리케이션을 [asar][asar] 아카이브로 패키징 할 수 있습니다.
|
어플리케이션의 리소스와 소스코드를 좋지 않은 사용자로부터 보호하기 위해 어플리케이션을 [asar][asar] 아카이브로 패키징 할 수 있습니다.
|
||||||
|
|
||||||
## `asar` 아카이브 생성
|
## `asar` 아카이브 생성
|
||||||
|
|
||||||
[asar][asar]아카이브는 tar과 비슷한 포맷으로 모든 리소스를 하나의 파일로 만듭니다.
|
[asar][asar] 아카이브는 tar과 비슷한 포맷으로 모든 리소스를 하나의 파일로 만듭니다.
|
||||||
그리고 Electron은 압축해제 없이 임의로 모든 파일을 읽어들일 수 있습니다.
|
그리고 Electron은 압축해제 없이 임의로 모든 파일을 읽어들일 수 있습니다.
|
||||||
|
|
||||||
다음 몇가지 단계를 통해 어플리케이션을 `asar` 아카이브로 압축할 수 있습니다:
|
다음 몇가지 단계를 통해 어플리케이션을 `asar` 아카이브로 압축할 수 있습니다:
|
||||||
|
@ -29,7 +29,7 @@ Electron은 Node.js로 부터 제공된 Node API와 Chromium으로부터 제공
|
||||||
|
|
||||||
### Node API
|
### Node API
|
||||||
|
|
||||||
`fs.readFile` 와 `require` 같은 Node API들을 지원하기 위해 Electron에선 `asar` 아카이브가 가상의 디렉터리 구조를 가지도록
|
Electron에선 `fs.readFile`과 `require` 같은 Node API들을 지원하기 위해 `asar` 아카이브가 가상의 디렉터리 구조를 가지도록
|
||||||
패치했습니다. 그래서 아카이브 내부에서 리소스들을 정상적인 파일 시스템처럼 접근할 수 있습니다.
|
패치했습니다. 그래서 아카이브 내부에서 리소스들을 정상적인 파일 시스템처럼 접근할 수 있습니다.
|
||||||
|
|
||||||
예를 들어 `/path/to`라는 경로에 `example.asar`라는 아카이브가 있다고 가정하면:
|
예를 들어 `/path/to`라는 경로에 `example.asar`라는 아카이브가 있다고 가정하면:
|
|
@ -211,12 +211,12 @@ window.setRepresentedFilename('/etc/passwd');
|
||||||
window.setDocumentEdited(true);
|
window.setDocumentEdited(true);
|
||||||
```
|
```
|
||||||
|
|
||||||
[addrecentdocument]: ../api/app-ko.md#appaddrecentdocumentpath
|
[addrecentdocument]: ../api/app.md#appaddrecentdocumentpath
|
||||||
[clearrecentdocuments]: ../api/app-ko.md#appclearrecentdocuments
|
[clearrecentdocuments]: ../api/app.md#appclearrecentdocuments
|
||||||
[setusertaskstasks]: ../api/app-ko.md#appsetusertaskstasks
|
[setusertaskstasks]: ../api/app.md#appsetusertaskstasks
|
||||||
[setprogressbar]: ../api/browser-window-ko.md#browserwindowsetprogressbarprogress
|
[setprogressbar]: ../api/browser-window.md#browserwindowsetprogressbarprogress
|
||||||
[setrepresentedfilename]: ../api/browser-window-ko.md#browserwindowsetrepresentedfilenamefilename
|
[setrepresentedfilename]: ../api/browser-window.md#browserwindowsetrepresentedfilenamefilename
|
||||||
[setdocumentedited]: ../api/browser-window-ko.md#browserwindowsetdocumenteditededited
|
[setdocumentedited]: ../api/browser-window.md#browserwindowsetdocumenteditededited
|
||||||
[app-registration]: http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85).aspx
|
[app-registration]: http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85).aspx
|
||||||
[unity-launcher]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher
|
[unity-launcher]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher
|
||||||
[setthumbarbuttons]: ../api/browser-window.md#browserwindowsetthumbarbuttonsbuttons
|
[setthumbarbuttons]: ../api/browser-window.md#browserwindowsetthumbarbuttonsbuttons
|
|
@ -2,17 +2,16 @@
|
||||||
|
|
||||||
## 소개
|
## 소개
|
||||||
|
|
||||||
Electron은 자바스크립트와 함께 제공되는 풍부한 네이티브 API를 이용하여 데스크톱 어플리케이션을 만들 수 있도록 해주는 프레임워크입니다.
|
Electron은 자바스크립트와 함께 제공된 풍부한 네이티브 API를 사용하여 멋진 데스크탑 어플리케이션을 만들 수 있도록 해주는 프레임워크입니다.
|
||||||
이 프레임워크의 io.js(node.js)는 웹 서버 개발이 아닌 데스크톱 어플리케이션 개발에 초점을 맞췄습니다.
|
이 프레임워크의 io.js(node.js)는 웹 서버 개발이 아닌 데스크탑 어플리케이션 개발에 초점을 맞췄습니다.
|
||||||
|
|
||||||
이것은 Electron이 GUI 라이브러리의 자바스크립트 바인딩이라는 뜻이 아닙니다.
|
이 말은 Electron이 GUI 라이브러리의 자바스크립트 바인딩이라는 뜻이 아닙니다.
|
||||||
대신에, Electron은 웹 페이지의 GUI를 사용합니다. 쉽게 말해 Electron은 자바스크립트를 사용하여 조작하는 작은 Chromium
|
대신, Electron은 웹 페이지의 GUI를 사용합니다. 쉽게 말해 Electron은 자바스크립트를 사용하여 조작하는 작은 Chromium 브라우저로 볼 수 있습니다.
|
||||||
브라우저로 볼 수 있습니다.
|
|
||||||
|
|
||||||
### 메인 프로세스
|
### 메인 프로세스
|
||||||
|
|
||||||
Electron은 실행될 때 __메인 프로세스__ 로 불리는 `package.json`의 `main` 스크립트를 호출합니다.
|
Electron은 실행될 때 __메인 프로세스__ 로 불리는 `package.json`의 `main` 스크립트를 호출합니다.
|
||||||
이 스크립트는 메인 프로세스에서 작동합니다. GUI 컴포넌트를 컨트롤하거나 웹 페이지 창을 생성할 수 있습니다.
|
이 스크립트는 메인 프로세스에서 작동합니다. GUI 컴포넌트를 조작하거나 웹 페이지 창을 생성할 수 있습니다.
|
||||||
|
|
||||||
### 랜더러 프로세스
|
### 랜더러 프로세스
|
||||||
|
|
||||||
|
@ -31,11 +30,11 @@ Electron 프로세스 내에서 작동하는 웹 페이지는 __랜더러 프로
|
||||||
랜더러 프로세스는 각각의 프로세스에 고립되며 웹 페이지의 작동에만 영향을 끼칩니다.
|
랜더러 프로세스는 각각의 프로세스에 고립되며 웹 페이지의 작동에만 영향을 끼칩니다.
|
||||||
|
|
||||||
웹 페이지 내에서 네이티브 GUI 리소스를 관리하는 것은 보안에 취약하고 리소스를 누수시킬 수 있기 때문에
|
웹 페이지 내에서 네이티브 GUI 리소스를 관리하는 것은 보안에 취약하고 리소스를 누수시킬 수 있기 때문에
|
||||||
웹 페이지 내에서는 네이티브 GUI와 관련된 API를 호출할 수 없도록 되어 있습니다.
|
기본적으로 웹 페이지 내에서는 네이티브 GUI와 관련된 API를 호출할 수 없도록 되어 있습니다.
|
||||||
만약 웹 페이지 내에서 GUI작업이 필요하다면 메인 프로세스에서 그 작업을 할 수 있도록 메인 프로세스와 통신을 해야합니다.
|
만약 웹 페이지 내에서 GUI작업이 필요하다면 메인 프로세스에서 그 작업을 할 수 있도록 메인 프로세스와 통신을 해야합니다.
|
||||||
|
|
||||||
Electron에는 메인 프로세스와 랜더러 프로세스간에 통신을 할 수 있도록 [ipc](../api/ipc-renderer-ko.md) 모듈을 제공하고 있습니다.
|
Electron에는 메인 프로세스와 랜더러 프로세스간에 통신을 할 수 있도록 [ipc](../api/ipc-renderer.md) 모듈을 제공하고 있습니다.
|
||||||
또한 [remote](../api/remote-ko.md) 모듈을 사용하여 RPC 스타일로 통신할 수도 있습니다.
|
또한 [remote](../api/remote.md) 모듈을 사용하여 RPC 스타일로 통신할 수도 있습니다.
|
||||||
|
|
||||||
## 첫번째 Electron 앱 만들기
|
## 첫번째 Electron 앱 만들기
|
||||||
|
|
||||||
|
@ -48,8 +47,8 @@ your-app/
|
||||||
└── index.html
|
└── index.html
|
||||||
```
|
```
|
||||||
|
|
||||||
`package.json`은 node 모듈의 package.json과 같습니다. 그리고 `main` 필드를 지정하여
|
`package.json`은 node 모듈의 package.json과 같습니다.
|
||||||
메인 프로세스로 사용할 어플리케이션 시작점을 정의할 수 있습니다.
|
그리고 `main` 필드에 스크립트 파일을 집어넣어 메인 프로세스로 사용할 엔트리 포인트를 지정할 수 있습니다.
|
||||||
예를 들어 사용할 수 있는 `package.json`은 다음과 같습니다:
|
예를 들어 사용할 수 있는 `package.json`은 다음과 같습니다:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
@ -104,7 +103,7 @@ app.on('ready', function() {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
마지막으로 사용자에게 보여줄 `index.html` 웹 페이지의 예제입니다:
|
마지막으로, 사용자에게 보여줄 `index.html` 웹 페이지의 예제입니다:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -122,7 +121,7 @@ app.on('ready', function() {
|
||||||
|
|
||||||
## 앱 실행하기
|
## 앱 실행하기
|
||||||
|
|
||||||
앱을 작성한 후 [어플리케이션 배포](./application-distribution-ko.md) 가이드를 따라 앱을 패키징 하고 패키징한 앱을 실행할 수 있습니다.
|
앱을 작성한 후 [어플리케이션 배포](application-distribution.md) 가이드를 따라 앱을 패키징 하고 패키징한 앱을 실행할 수 있습니다.
|
||||||
또는 Electron 실행파일을 다운로드 받아 바로 실행해 볼 수도 있습니다.
|
또는 Electron 실행파일을 다운로드 받아 바로 실행해 볼 수도 있습니다.
|
||||||
|
|
||||||
### electron-prebuilt
|
### electron-prebuilt
|
||||||
|
@ -169,9 +168,9 @@ $ ./electron/electron your-app/
|
||||||
$ ./Electron.app/Contents/MacOS/Electron your-app/
|
$ ./Electron.app/Contents/MacOS/Electron your-app/
|
||||||
```
|
```
|
||||||
|
|
||||||
앱 실행파일은 `Electron`의 release 패키지에 포함되어 있습니다.
|
어플리케이션 실행파일은 `Electron`의 release 패키지에 포함되어 있습니다.
|
||||||
[여기](https://github.com/atom/electron/releases)에서 다운로드 받을 수 있습니다.
|
[여기](https://github.com/atom/electron/releases)에서 다운로드 받을 수 있습니다.
|
||||||
|
|
||||||
### 배포용 파일 만들기
|
### 배포용 파일 만들기
|
||||||
|
|
||||||
모든 앱 작성이 끝났다면 [어플리케이션 배포](./application-distribution-ko.md) 가이드를 보고 본격적으로 제작한 앱을 배포할 수 있습니다.
|
어플리케이션 작성을 완료했다면 [어플리케이션 배포](application-distribution.md) 가이드를 통해 본격적으로 제작한 앱을 배포할 수 있습니다.
|
|
@ -69,6 +69,6 @@ driver.quit();
|
||||||
## 작업환경
|
## 작업환경
|
||||||
|
|
||||||
따로 Electron을 다시 빌드하지 않는 경우 간단히 어플리케이션을 Electron의 리소스 디렉터리에
|
따로 Electron을 다시 빌드하지 않는 경우 간단히 어플리케이션을 Electron의 리소스 디렉터리에
|
||||||
[배치](https://github.com/atom/electron/blob/master/docs/tutorial/application-distribution-ko.md)하여 바로 테스트 할 수 있습니다.
|
[배치](application-distribution.md)하여 바로 테스트 할 수 있습니다.
|
||||||
|
|
||||||
[chrome-driver]: https://sites.google.com/a/chromium.org/chromedriver/
|
[chrome-driver]: https://sites.google.com/a/chromium.org/chromedriver/
|
217
docs/api/app.md
217
docs/api/app.md
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
The `app` module is responsible for controlling the application's lifecycle.
|
The `app` module is responsible for controlling the application's lifecycle.
|
||||||
|
|
||||||
The following example shows how to quit the application when the last window is closed:
|
The following example shows how to quit the application when the last window is
|
||||||
|
closed:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var app = require('app');
|
var app = require('app');
|
||||||
|
@ -11,30 +12,36 @@ app.on('window-all-closed', function() {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Event: will-finish-launching
|
## Events
|
||||||
|
|
||||||
|
The `app` object emits the following events:
|
||||||
|
|
||||||
|
### Event: 'will-finish-launching'
|
||||||
|
|
||||||
Emitted when the application has finished basic startup. On Windows and Linux,
|
Emitted when the application has finished basic startup. On Windows and Linux,
|
||||||
the `will-finish-launching` event is the same as the `ready` event; on OS X,
|
the `will-finish-launching` event is the same as the `ready` event; on OS X,
|
||||||
this event represents the `applicationWillFinishLaunching` notification of `NSApplication`.
|
this event represents the `applicationWillFinishLaunching` notification of
|
||||||
You would usually set up listeners for the `open-file` and `open-url` events here,
|
`NSApplication`. You would usually set up listeners for the `open-file` and
|
||||||
and start the crash reporter and auto updater.
|
`open-url` events here, and start the crash reporter and auto updater.
|
||||||
|
|
||||||
In most cases, you should just do everything in the `ready` event handler.
|
In most cases, you should just do everything in the `ready` event handler.
|
||||||
|
|
||||||
## Event: ready
|
### Event: 'ready'
|
||||||
|
|
||||||
Emitted when Electron has finished initialization.
|
Emitted when Electron has finished initialization.
|
||||||
|
|
||||||
## Event: window-all-closed
|
### Event: 'window-all-closed'
|
||||||
|
|
||||||
Emitted when all windows have been closed.
|
Emitted when all windows have been closed.
|
||||||
|
|
||||||
This event is only emitted when the application is not going to quit. If the
|
This event is only emitted when the application is not going to quit. If the
|
||||||
user pressed `Cmd + Q`, or the developer called `app.quit()`, Electron would
|
user pressed `Cmd + Q`, or the developer called `app.quit()`, Electron will
|
||||||
first try to close all the windows and then emit the `will-quit` event, and in
|
first try to close all the windows and then emit the `will-quit` event, and in
|
||||||
this case the `window-all-closed` event would not be emitted.
|
this case the `window-all-closed` event would not be emitted.
|
||||||
|
|
||||||
## Event: before-quit
|
### Event: 'before-quit'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
|
|
||||||
|
@ -42,7 +49,9 @@ Emitted before the application starts closing its windows.
|
||||||
Calling `event.preventDefault()` will prevent the default behaviour, which is
|
Calling `event.preventDefault()` will prevent the default behaviour, which is
|
||||||
terminating the application.
|
terminating the application.
|
||||||
|
|
||||||
## Event: will-quit
|
### Event: 'will-quit'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
|
|
||||||
|
@ -50,28 +59,32 @@ Emitted when all windows have been closed and the application will quit.
|
||||||
Calling `event.preventDefault()` will prevent the default behaviour, which is
|
Calling `event.preventDefault()` will prevent the default behaviour, which is
|
||||||
terminating the application.
|
terminating the application.
|
||||||
|
|
||||||
See the description of the `window-all-closed` event for the differences between the `will-quit`
|
See the description of the `window-all-closed` event for the differences between
|
||||||
and `window-all-closed` events.
|
the `will-quit` and `window-all-closed` events.
|
||||||
|
|
||||||
## Event: quit
|
### Event: 'quit'
|
||||||
|
|
||||||
Emitted when the application is quitting.
|
Emitted when the application is quitting.
|
||||||
|
|
||||||
## Event: open-file
|
### Event: 'open-file'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `path` String
|
* `path` String
|
||||||
|
|
||||||
Emitted when the user wants to open a file with the application. The `open-file` event
|
Emitted when the user wants to open a file with the application. The `open-file`
|
||||||
is usually emitted when the application is already open and the OS wants to reuse the
|
event is usually emitted when the application is already open and the OS wants
|
||||||
application to open the file. `open-file` is also emitted when a file is dropped onto the
|
to reuse the application to open the file. `open-file` is also emitted when a
|
||||||
dock and the application is not yet running. Make sure to listen for the `open-file`
|
file is dropped onto the dock and the application is not yet running. Make sure
|
||||||
event very early in your application startup to handle this case (even before the
|
to listen for the `open-file` event very early in your application startup to
|
||||||
`ready` event is emitted).
|
handle this case (even before the `ready` event is emitted).
|
||||||
|
|
||||||
You should call `event.preventDefault()` if you want to handle this event.
|
You should call `event.preventDefault()` if you want to handle this event.
|
||||||
|
|
||||||
## Event: open-url
|
### Event: 'open-url'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `url` String
|
* `url` String
|
||||||
|
@ -81,20 +94,24 @@ must be registered to be opened by your application.
|
||||||
|
|
||||||
You should call `event.preventDefault()` if you want to handle this event.
|
You should call `event.preventDefault()` if you want to handle this event.
|
||||||
|
|
||||||
## Event: activate-with-no-open-windows
|
### Event: 'activate-with-no-open-windows'
|
||||||
|
|
||||||
Emitted when the application is activated while there are no open windows, which
|
Emitted when the application is activated while there are no open windows, which
|
||||||
usually happens when the user has closed all of the application's windows and then
|
usually happens when the user has closed all of the application's windows and
|
||||||
clicks on the application's dock icon.
|
then clicks on the application's dock icon.
|
||||||
|
|
||||||
## Event: browser-window-blur
|
### Event: 'browser-window-blur'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `window` BrowserWindow
|
* `window` BrowserWindow
|
||||||
|
|
||||||
Emitted when a [browserWindow](browser-window.md) gets blurred.
|
Emitted when a [browserWindow](browser-window.md) gets blurred.
|
||||||
|
|
||||||
## Event: browser-window-focus
|
### Event: 'browser-window-focus'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `window` BrowserWindow
|
* `window` BrowserWindow
|
||||||
|
@ -105,6 +122,8 @@ Emitted when a [browserWindow](browser-window.md) gets focused.
|
||||||
|
|
||||||
Emitted when a client certificate is requested.
|
Emitted when a client certificate is requested.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `webContents` [WebContents](browser-window.md#class-webcontents)
|
* `webContents` [WebContents](browser-window.md#class-webcontents)
|
||||||
* `url` String
|
* `url` String
|
||||||
|
@ -113,37 +132,43 @@ Emitted when a client certificate is requested.
|
||||||
* `issuerName` Issuer's Common Name
|
* `issuerName` Issuer's Common Name
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
app.on('select-certificate', function(event, host, url, list, callback) {
|
app.on('select-certificate', function(event, host, url, list, callback) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
callback(list[0]);
|
callback(list[0]);
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
`url` corresponds to the navigation entry requesting the client certificate.
|
The `url` corresponds to the navigation entry requesting the client certificate
|
||||||
`callback` needs to be called with an entry filtered from the list.
|
and `callback` needs to be called with an entry filtered from the list. Using
|
||||||
`event.preventDefault()` prevents the application from using the first certificate
|
`event.preventDefault()` prevents the application from using the first
|
||||||
from the store.
|
certificate from the store.
|
||||||
|
|
||||||
### Event: 'gpu-process-crashed'
|
### Event: 'gpu-process-crashed'
|
||||||
|
|
||||||
Emitted when the gpu process crashes.
|
Emitted when the gpu process crashes.
|
||||||
|
|
||||||
## app.quit()
|
## Methods
|
||||||
|
|
||||||
Try to close all windows. The `before-quit` event will first be emitted. If all
|
The `app` object has the following methods:
|
||||||
|
|
||||||
|
**Note** Some methods are only available on specific operating systems and are labeled as such.
|
||||||
|
|
||||||
|
### `app.quit()`
|
||||||
|
|
||||||
|
Try to close all windows. The `before-quit` event will emitted first. If all
|
||||||
windows are successfully closed, the `will-quit` event will be emitted and by
|
windows are successfully closed, the `will-quit` event will be emitted and by
|
||||||
default the application will terminate.
|
default the application will terminate.
|
||||||
|
|
||||||
This method guarantees that all `beforeunload` and `unload` event handlers are correctly
|
This method guarantees that all `beforeunload` and `unload` event handlers are
|
||||||
executed. It is possible that a window cancels the quitting by returning
|
correctly executed. It is possible that a window cancels the quitting by
|
||||||
`false` in the `beforeunload` event handler.
|
returning `false` in the `beforeunload` event handler.
|
||||||
|
|
||||||
## app.getAppPath()
|
### `app.getAppPath()`
|
||||||
|
|
||||||
Returns the current application directory.
|
Returns the current application directory.
|
||||||
|
|
||||||
## app.getPath(name)
|
### `app.getPath(name)`
|
||||||
|
|
||||||
* `name` String
|
* `name` String
|
||||||
|
|
||||||
|
@ -152,25 +177,25 @@ failure an `Error` is thrown.
|
||||||
|
|
||||||
You can request the following paths by the name:
|
You can request the following paths by the name:
|
||||||
|
|
||||||
* `home`: User's home directory
|
* `home` User's home directory.
|
||||||
* `appData`: Per-user application data directory, which by default points to:
|
* `appData` Per-user application data directory, which by default points to:
|
||||||
* `%APPDATA%` on Windows
|
* `%APPDATA%` on Windows
|
||||||
* `$XDG_CONFIG_HOME` or `~/.config` on Linux
|
* `$XDG_CONFIG_HOME` or `~/.config` on Linux
|
||||||
* `~/Library/Application Support` on OS X
|
* `~/Library/Application Support` on OS X
|
||||||
* `userData`: The directory for storing your app's configuration files, which by
|
* `userData` The directory for storing your app's configuration files, which by
|
||||||
default it is the `appData` directory appended with your app's name
|
default it is the `appData` directory appended with your app's name.
|
||||||
* `cache`: Per-user application cache directory, which by default points to:
|
* `cache` Per-user application cache directory, which by default points to:
|
||||||
* `%APPDATA%` on Windows (which doesn't have a universal cache location)
|
* `%APPDATA%` on Windows (which doesn't have a universal cache location)
|
||||||
* `$XDG_CACHE_HOME` or `~/.cache` on Linux
|
* `$XDG_CACHE_HOME` or `~/.cache` on Linux
|
||||||
* `~/Library/Caches` on OS X
|
* `~/Library/Caches` on OS X
|
||||||
* `userCache`: The directory for placing your app's caches, by default it is the
|
* `userCache` The directory for placing your app's caches, by default it is the
|
||||||
`cache` directory appended with your app's name
|
`cache` directory appended with your app's name.
|
||||||
* `temp`: Temporary directory
|
* `temp` Temporary directory.
|
||||||
* `userDesktop`: The current user's Desktop directory
|
* `userDesktop` The current user's Desktop directory.
|
||||||
* `exe`: The current executable file
|
* `exe` The current executable file.
|
||||||
* `module`: The `libchromiumcontent` library
|
* `module` The `libchromiumcontent` library.
|
||||||
|
|
||||||
## app.setPath(name, path)
|
### `app.setPath(name, path)`
|
||||||
|
|
||||||
* `name` String
|
* `name` String
|
||||||
* `path` String
|
* `path` String
|
||||||
|
@ -179,19 +204,19 @@ Overrides the `path` to a special directory or file associated with `name`. If
|
||||||
the path specifies a directory that does not exist, the directory will be
|
the path specifies a directory that does not exist, the directory will be
|
||||||
created by this method. On failure an `Error` is thrown.
|
created by this method. On failure an `Error` is thrown.
|
||||||
|
|
||||||
You can only override paths of `name`s defined in `app.getPath`.
|
You can only override paths of a `name` defined in `app.getPath`.
|
||||||
|
|
||||||
By default, web pages' cookies and caches will be stored under the `userData`
|
By default, web pages's cookies and caches will be stored under the `userData`
|
||||||
directory. If you want to change this location, you have to override the
|
directory. If you want to change this location, you have to override the
|
||||||
`userData` path before the `ready` event of the `app` module is emitted.
|
`userData` path before the `ready` event of the `app` module is emitted.
|
||||||
|
|
||||||
## app.getVersion()
|
### `app.getVersion()`
|
||||||
|
|
||||||
Returns the version of the loaded application. If no version is found in the
|
Returns the version of the loaded application. If no version is found in the
|
||||||
application's `package.json` file, the version of the current bundle or executable is
|
application's `package.json` file, the version of the current bundle or
|
||||||
returned.
|
executable is returned.
|
||||||
|
|
||||||
## app.getName()
|
### `app.getName()`
|
||||||
|
|
||||||
Returns the current application's name, which is the name in the application's
|
Returns the current application's name, which is the name in the application's
|
||||||
`package.json` file.
|
`package.json` file.
|
||||||
|
@ -201,7 +226,7 @@ to the npm modules spec. You should usually also specify a `productName`
|
||||||
field, which is your application's full capitalized name, and which will be
|
field, which is your application's full capitalized name, and which will be
|
||||||
preferred over `name` by Electron.
|
preferred over `name` by Electron.
|
||||||
|
|
||||||
## app.resolveProxy(url, callback)
|
### `app.resolveProxy(url, callback)`
|
||||||
|
|
||||||
* `url` URL
|
* `url` URL
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
@ -209,7 +234,7 @@ preferred over `name` by Electron.
|
||||||
Resolves the proxy information for `url`. The `callback` will be called with
|
Resolves the proxy information for `url`. The `callback` will be called with
|
||||||
`callback(proxy)` when the request is performed.
|
`callback(proxy)` when the request is performed.
|
||||||
|
|
||||||
## app.addRecentDocument(path)
|
### `app.addRecentDocument(path)`
|
||||||
|
|
||||||
* `path` String
|
* `path` String
|
||||||
|
|
||||||
|
@ -218,11 +243,11 @@ Adds `path` to the recent documents list.
|
||||||
This list is managed by the OS. On Windows you can visit the list from the task
|
This list is managed by the OS. On Windows you can visit the list from the task
|
||||||
bar, and on OS X you can visit it from dock menu.
|
bar, and on OS X you can visit it from dock menu.
|
||||||
|
|
||||||
## app.clearRecentDocuments()
|
### `app.clearRecentDocuments()`
|
||||||
|
|
||||||
Clears the recent documents list.
|
Clears the recent documents list.
|
||||||
|
|
||||||
## app.setUserTasks(tasks)
|
### `app.setUserTasks(tasks)` _Windows_
|
||||||
|
|
||||||
* `tasks` Array - Array of `Task` objects
|
* `tasks` Array - Array of `Task` objects
|
||||||
|
|
||||||
|
@ -230,92 +255,78 @@ Adds `tasks` to the [Tasks][tasks] category of the JumpList on Windows.
|
||||||
|
|
||||||
`tasks` is an array of `Task` objects in following format:
|
`tasks` is an array of `Task` objects in following format:
|
||||||
|
|
||||||
* `Task` Object
|
`Task` Object
|
||||||
* `program` String - Path of the program to execute, usually you should
|
* `program` String - Path of the program to execute, usually you should
|
||||||
specify `process.execPath` which opens the current program
|
specify `process.execPath` which opens the current program.
|
||||||
* `arguments` String - The command line arguments when `program` is
|
* `arguments` String - The command line arguments when `program` is
|
||||||
executed
|
executed.
|
||||||
* `title` String - The string to be displayed in a JumpList
|
* `title` String - The string to be displayed in a JumpList.
|
||||||
* `description` String - Description of this task
|
* `description` String - Description of this task.
|
||||||
* `iconPath` String - The absolute path to an icon to be displayed in a
|
* `iconPath` String - The absolute path to an icon to be displayed in a
|
||||||
JumpList, which can be an arbitrary resource file that contains an icon. You can
|
JumpList, which can be an arbitrary resource file that contains an icon. You
|
||||||
usually specify `process.execPath` to show the icon of the program
|
can usually specify `process.execPath` to show the icon of the program.
|
||||||
* `iconIndex` Integer - The icon index in the icon file. If an icon file
|
* `iconIndex` Integer - The icon index in the icon file. If an icon file
|
||||||
consists of two or more icons, set this value to identify the icon. If an
|
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
|
icon file consists of one icon, this value is 0.
|
||||||
|
|
||||||
**Note:** This API is only available on Windows.
|
|
||||||
|
|
||||||
## app.commandLine.appendSwitch(switch, [value])
|
### `app.commandLine.appendSwitch(switch[, value])`
|
||||||
|
|
||||||
Append a switch [with optional value] to Chromium's command line.
|
Append a switch (with optional `value`) to Chromium's command line.
|
||||||
|
|
||||||
**Note:** This will not affect `process.argv`, and is mainly used by developers
|
**Note:** This will not affect `process.argv`, and is mainly used by developers
|
||||||
to control some low-level Chromium behaviors.
|
to control some low-level Chromium behaviors.
|
||||||
|
|
||||||
## app.commandLine.appendArgument(value)
|
### `app.commandLine.appendArgument(value)`
|
||||||
|
|
||||||
Append an argument to Chromium's command line. The argument will be quoted correctly.
|
Append an argument to Chromium's command line. The argument will be quoted
|
||||||
|
correctly.
|
||||||
|
|
||||||
**Note:** This will not affect `process.argv`.
|
**Note:** This will not affect `process.argv`.
|
||||||
|
|
||||||
## app.dock.bounce([type])
|
### `app.dock.bounce([type])` _OS X_
|
||||||
|
|
||||||
* `type` String - Can be `critical` or `informational`. The default is
|
* `type` String (optional) - Can be `critical` or `informational`. The default is
|
||||||
`informational`
|
`informational`
|
||||||
|
|
||||||
When `critical` is passed, the dock icon will bounce until either the
|
When `critical` is passed, the dock icon will bounce until either the
|
||||||
application becomes active or the request is canceled.
|
application becomes active or the request is canceled.
|
||||||
|
|
||||||
When `informational` is passed, the dock icon will bounce for one second. However,
|
When `informational` is passed, the dock icon will bounce for one second.
|
||||||
the request remains active until either the application becomes active or
|
However, the request remains active until either the application becomes active
|
||||||
the request is canceled.
|
or the request is canceled.
|
||||||
|
|
||||||
An ID representing the request is returned.
|
Returns an ID representing the request.
|
||||||
|
|
||||||
**Note:** This API is only available on OS X.
|
### `app.dock.cancelBounce(id)` _OS X_
|
||||||
|
|
||||||
## app.dock.cancelBounce(id)
|
|
||||||
|
|
||||||
* `id` Integer
|
* `id` Integer
|
||||||
|
|
||||||
Cancel the bounce of `id`.
|
Cancel the bounce of `id`.
|
||||||
|
|
||||||
**Note:** This API is only available on OS X.
|
### `app.dock.setBadge(text)` _OS X_
|
||||||
|
|
||||||
## app.dock.setBadge(text)
|
|
||||||
|
|
||||||
* `text` String
|
* `text` String
|
||||||
|
|
||||||
Sets the string to be displayed in the dock’s badging area.
|
Sets the string to be displayed in the dock’s badging area.
|
||||||
|
|
||||||
**Note:** This API is only available on OS X.
|
### `app.dock.getBadge()` _OS X_
|
||||||
|
|
||||||
## app.dock.getBadge()
|
|
||||||
|
|
||||||
Returns the badge string of the dock.
|
Returns the badge string of the dock.
|
||||||
|
|
||||||
**Note:** This API is only available on OS X.
|
### `app.dock.hide()` _OS X_
|
||||||
|
|
||||||
## app.dock.hide()
|
|
||||||
|
|
||||||
Hides the dock icon.
|
Hides the dock icon.
|
||||||
|
|
||||||
**Note:** This API is only available on OS X.
|
### `app.dock.show()` _OS X_
|
||||||
|
|
||||||
## app.dock.show()
|
|
||||||
|
|
||||||
Shows the dock icon.
|
Shows the dock icon.
|
||||||
|
|
||||||
**Note:** This API is only available on OS X.
|
### `app.dock.setMenu(menu)` _OS X_
|
||||||
|
|
||||||
## app.dock.setMenu(menu)
|
|
||||||
|
|
||||||
* `menu` Menu
|
* `menu` Menu
|
||||||
|
|
||||||
Sets the application's [dock menu][dock-menu].
|
Sets the application's [dock menu][dock-menu].
|
||||||
|
|
||||||
**Note:** This API is only available on OS X.
|
|
||||||
|
|
||||||
[dock-menu]:https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/customizing_docktile/concepts/dockconcepts.html#//apple_ref/doc/uid/TP30000986-CH2-TPXREF103
|
[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
|
[tasks]:http://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# auto-updater
|
# autoUpdater
|
||||||
|
|
||||||
**This module has only been implemented for OS X.**
|
**This module has only been implemented for OS X.**
|
||||||
|
|
||||||
|
@ -98,27 +98,35 @@ appropriate format.
|
||||||
|
|
||||||
`pub_date` (if present) must be formatted according to ISO 8601.
|
`pub_date` (if present) must be formatted according to ISO 8601.
|
||||||
|
|
||||||
## Event: error
|
## Events
|
||||||
|
|
||||||
|
The `autoUpdater` object emits the following events:
|
||||||
|
|
||||||
|
### Event: 'error'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `message` String
|
* `message` String
|
||||||
|
|
||||||
Emitted when there is an error while updating.
|
Emitted when there is an error while updating.
|
||||||
|
|
||||||
## Event: checking-for-update
|
### Event: 'checking-for-update'
|
||||||
|
|
||||||
Emitted when checking if an update has started.
|
Emitted when checking if an update has started.
|
||||||
|
|
||||||
## Event: update-available
|
### Event: 'update-available'
|
||||||
|
|
||||||
Emitted when there is an available update. The update is downloaded
|
Emitted when there is an available update. The update is downloaded
|
||||||
automatically.
|
automatically.
|
||||||
|
|
||||||
## Event: update-not-available
|
### Event: 'update-not-available'
|
||||||
|
|
||||||
Emitted when there is no available update.
|
Emitted when there is no available update.
|
||||||
|
|
||||||
## Event: update-downloaded
|
### Event: 'update-downloaded'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `releaseNotes` String
|
* `releaseNotes` String
|
||||||
|
@ -127,17 +135,21 @@ Emitted when there is no available update.
|
||||||
* `updateUrl` String
|
* `updateUrl` String
|
||||||
* `quitAndUpdate` Function
|
* `quitAndUpdate` Function
|
||||||
|
|
||||||
Emitted when an update has been downloaded. Calling `quitAndUpdate()` will restart
|
Emitted when an update has been downloaded. Calling `quitAndUpdate()` will
|
||||||
the application and install the update.
|
restart the application and install the update.
|
||||||
|
|
||||||
## autoUpdater.setFeedUrl(url)
|
## Methods
|
||||||
|
|
||||||
|
The `autoUpdater` object has the following methods:
|
||||||
|
|
||||||
|
### `autoUpdater.setFeedUrl(url)`
|
||||||
|
|
||||||
* `url` String
|
* `url` String
|
||||||
|
|
||||||
Set the `url` and initialize the auto updater. The `url` cannot be changed
|
Set the `url` and initialize the auto updater. The `url` cannot be changed
|
||||||
once it is set.
|
once it is set.
|
||||||
|
|
||||||
## autoUpdater.checkForUpdates()
|
### `autoUpdater.checkForUpdates()`
|
||||||
|
|
||||||
Ask the server whether there is an update. You must call `setFeedUrl` before
|
Ask the server whether there is an update. You must call `setFeedUrl` before
|
||||||
using this API.
|
using this API.
|
||||||
|
|
|
@ -589,10 +589,6 @@ called with `callback(image)`, the `image` is an instance of
|
||||||
[NativeImage](native-image.md) that stores data of the snapshot. Omitting the
|
[NativeImage](native-image.md) that stores data of the snapshot. Omitting the
|
||||||
`rect` would capture the whole visible page.
|
`rect` would capture the whole visible page.
|
||||||
|
|
||||||
**Note:** Be sure to read documents on remote buffer in
|
|
||||||
[remote](remote.md) if you are going to use this API in renderer
|
|
||||||
process.
|
|
||||||
|
|
||||||
### BrowserWindow.print([options])
|
### BrowserWindow.print([options])
|
||||||
|
|
||||||
Same with `webContents.print([options])`
|
Same with `webContents.print([options])`
|
||||||
|
|
|
@ -54,7 +54,8 @@ You can also only build the Debug target:
|
||||||
python script\build.py -c D
|
python script\build.py -c D
|
||||||
```
|
```
|
||||||
|
|
||||||
After building is done, you can find `atom.exe` under `out\D`.
|
After building is done, you can find `electron.exe` under `out\D` (debug
|
||||||
|
target) or under `out\R` (release target).
|
||||||
|
|
||||||
## 64bit build
|
## 64bit build
|
||||||
|
|
||||||
|
|
78
docs/styleguide.md
Normal file
78
docs/styleguide.md
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# Electron Documentation Styleguide
|
||||||
|
|
||||||
|
Find the appropriate section for your task: [reading Electron documentation](#)
|
||||||
|
or [writing Electron documentation](#).
|
||||||
|
|
||||||
|
## Writing Electron Documentation
|
||||||
|
|
||||||
|
These are the ways that we construct the Electron documentation.
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
- ```### `method(foo, bar)` _OS X_```
|
||||||
|
|
||||||
|
## Reading Electron Documentation
|
||||||
|
|
||||||
|
Here are some tips for understanding Electron documentation syntax.
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
An example of [method](https://developer.mozilla.org/en-US/docs/Glossary/Method)
|
||||||
|
documentation:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
`methodName(required[, optional]))`
|
||||||
|
|
||||||
|
* `require` String, **required**
|
||||||
|
* `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).
|
||||||
|
|
||||||
|
### Events
|
||||||
|
|
||||||
|
An example of [event](https://developer.mozilla.org/en-US/docs/Web/API/Event)
|
||||||
|
documentation:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Event: 'wake-up'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `time` String
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
Alarm.on('wake-up', function(time) {
|
||||||
|
console.log(time)
|
||||||
|
})
|
||||||
|
```
|
|
@ -67,6 +67,9 @@ like this:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
__Note__: If the `main` field is not present in `package.json`, Electron will
|
||||||
|
attempt to load an `index.js`.
|
||||||
|
|
||||||
The `main.js` should create windows and handle system events, a typical
|
The `main.js` should create windows and handle system events, a typical
|
||||||
example being:
|
example being:
|
||||||
|
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 5b2a73c68a986780e67eb2e738327d35c7c1c21e
|
Subproject commit 0bf81275795b15eb361a1fd213ae9c7c1f60bdea
|
Loading…
Add table
Add a link
Reference in a new issue