]> khamidou — GitHub mirrors - electron.git/commitdiff
docs: Put window.open docs in its own chapter, regards #1137
authorCheng Zhao <zcbenz@gmail.com>
Wed, 4 Mar 2015 16:47:04 +0000 (08:47 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 4 Mar 2015 16:47:04 +0000 (08:47 -0800)
docs/README.md
docs/api/browser-window.md
docs/api/window-open.md [new file with mode: 0644]

index 474883f9ef35947125a333c064a76a7834cbf8e8..9f859de9cb8c9b60a2b98420f308a2493b2f09ef 100644 (file)
@@ -20,6 +20,7 @@ Custom DOM elements:
 
 * [`File` object](api/file-object.md)
 * [`<webview>` tag](api/web-view-tag.md)
+* [`window.open` function](api/window-open.md)
 
 Modules for browser side:
 
index d3ac51f4464c75673cea4537763c12a88c7a7cb9..a8456b5767de3a85ace8af0d4cd4b1fb159550ad 100644 (file)
@@ -641,7 +641,8 @@ Emitted when a redirect was received while requesting a resource.
 
 Emitted when the page requested to open a new window for `url`. It could be
 requested by `window.open` or an external link like `<a target='_blank'>`.
-Check the next section [Handling Child Windows](#handling-child-windows) for more information.
+
+By default a new `BrowserWindow` will be created for the `url`.
 
 Calling `event.preventDefault()` can prevent creating new windows.
 
@@ -842,52 +843,3 @@ app.on('ready', function() {
    is different from the handlers on browser side.
 2. There is no way to send synchronous messages from browser side to web pages,
    because it would be very easy to cause dead locks.
-
-## Handling Child Windows
-
-When the page contents request opening a new window, either by invoking
-`window.open` or by an external link such as `<a target='_blank'>`, by
-default a new `BrowserWindow` will be created for the `url`, and a proxy
-will be returned to `window.open` to let the page to have limited control over it.
-
-The proxy has some limited standard functionality implemented, which will help
-the page to interact with it. The following methods are avaialable:
-
-### Window.blur()
-
-Removes focus from the child window.
-
-### Window.close()
-
-Forcefully closes the child window without calling its unload event.
-
-### Window.closed
-
-Set to true after the child window gets closed.
-
-### Window.eval(code)
-
-* `code` String
-
-Evaluates the code in the child window.
-
-### Window.focus()
-
-Focuses the child window (brings the window to front).
-
-### Window.postMessage(message, targetOrigin)
-
-* `message` String
-* `targetOrigin` String
-
-Sends a message to the child window with the specified origin or "*" for no origin preference.
-
-In addition to these methods, the child window implements `window.opener` object with no properties
-and a single method:
-
-### window.opener.postMessage(message, targetOrigin)
-
-* `message` String
-* `targetOrigin` String
-
-Sends a message to the parent window with the specified origin or "*" for no origin preference.
diff --git a/docs/api/window-open.md b/docs/api/window-open.md
new file mode 100644 (file)
index 0000000..23bcf2b
--- /dev/null
@@ -0,0 +1,60 @@
+# `window.open` function
+
+When `window.open` is called to create a new window in web page, a new instance
+of `BrowserWindow` will be created for the `url`, and a proxy will be returned
+to `window.open` to let the page to have limited control over it.
+
+The proxy only has some limited standard functionality implemented to be
+compatible with traditional web pages, for full control of the created window
+you should create a `BrowserWindow` directly.
+
+## window.open(url, [frameName[, features]])
+
+* `url` String
+* `frameName` String
+* `features` String
+
+Creates a new window and returns an instance of `BrowserWindowProxy` class.
+
+## window.opener.postMessage(message, targetOrigin)
+
+* `message` String
+* `targetOrigin` String
+
+Sends a message to the parent window with the specified origin or `*` for no
+origin preference.
+
+## Class: BrowserWindowProxy
+
+### BrowserWindowProxy.blur()
+
+Removes focus from the child window.
+
+### BrowserWindowProxy.close()
+
+Forcefully closes the child window without calling its unload event.
+
+### BrowserWindowProxy.closed
+
+Set to true after the child window gets closed.
+
+### BrowserWindowProxy.eval(code)
+
+* `code` String
+
+Evaluates the code in the child window.
+
+### BrowserWindowProxy.focus()
+
+Focuses the child window (brings the window to front).
+
+### BrowserWindowProxy.postMessage(message, targetOrigin)
+
+* `message` String
+* `targetOrigin` String
+
+Sends a message to the child window with the specified origin or `*` for no
+origin preference.
+
+In addition to these methods, the child window implements `window.opener` object
+with no properties and a single method: