Discard the require('atom-delegate') API.
This commit is contained in:
parent
75c44ca057
commit
5b12f80d01
8 changed files with 2 additions and 57 deletions
|
@ -22,7 +22,6 @@ Renderer side modules:
|
|||
Browser side modules:
|
||||
|
||||
* [app](api/browser/app.md)
|
||||
* [atom-delegate](api/browser/atom-delegate.md)
|
||||
* [auto-updater](api/browser/auto-updater.md)
|
||||
* [browser-window](api/browser/browser-window.md)
|
||||
* [dialog](api/browser/dialog.md)
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# atom-delegate
|
||||
|
||||
The `atom-delegate` returns the delegate object for Chrome Content API. The
|
||||
atom-shell would call methods of the delegate object when the corresponding
|
||||
C++ code is called. Developers can override methods of it to control the
|
||||
underlying behaviour of the browser.
|
||||
|
||||
An example of creating a new window when the browser is initialized:
|
||||
|
||||
```javascript
|
||||
var delegate = require('atom-delegate'); // Delegate of Content API.
|
||||
var BrowserWindow = require('browser-window'); // Module to create native browser window.
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the javascript object is GCed.
|
||||
var mainWindow = null;
|
||||
|
||||
// This method will be called when atom-shell has done everything
|
||||
// initialization and ready for creating browser windows.
|
||||
delegate.browserMainParts.preMainMessageLoopRun = function() {
|
||||
// Create the browser window,
|
||||
mainWindow = new BrowserWindow({ width: 800, height: 600 });
|
||||
// and load the index.html of the app.
|
||||
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
||||
}
|
||||
```
|
||||
|
||||
## atom-delegate.browserMainParts.preMainMessageLoopRun()
|
||||
|
||||
Called when atom-shell has done everything initialization and ready for
|
||||
creating browser windows.
|
|
@ -53,7 +53,6 @@ every piece of the app. An example of `main.js` is:
|
|||
|
||||
```javascript
|
||||
var app = require('app'); // Module to control application life.
|
||||
var delegate = require('atom_delegate'); // Delegate of Content API.
|
||||
var Window = require('window'); // Module to create native browser window.
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
|
@ -67,7 +66,7 @@ app.on('window-all-closed', function() {
|
|||
|
||||
// This method will be called when atom-shell has done everything
|
||||
// initialization and ready for creating browser windows.
|
||||
delegate.browserMainParts.preMainMessageLoopRun = function() {
|
||||
app.on('finish-launching', function() {
|
||||
// Create the browser window,
|
||||
mainWindow = new Window({ width: 800, height: 600 });
|
||||
// and load the index.html of the app.
|
||||
|
@ -89,7 +88,7 @@ delegate.browserMainParts.preMainMessageLoopRun = function() {
|
|||
// when you should delete the corresponding element.
|
||||
mainWindow = null;
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Finally the `index.html` is the web page you want to show, in fact you
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue