]> khamidou — GitHub mirrors - electron.git/commitdiff
Rename 'finish-launching' event to 'ready',
authorCheng Zhao <zcbenz@gmail.com>
Fri, 27 Dec 2013 03:08:26 +0000 (11:08 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 27 Dec 2013 03:08:26 +0000 (11:08 +0800)
'finish-launching' is more like a OS X message name, and in atom-shell
it means initialization has done, so 'ready' seems to be a better name
and more easy to remember.

The 'will-finish-launching' event just represents the corresponding
message on OS X and is the same with 'ready' on other platforms, so we
keep its name to indicate that it's only useful for OS X specified
code.

browser/api/atom_api_app.cc
browser/api/lib/app.coffee
browser/default_app/default_app.js
docs/api/browser/app.md
docs/quick-start.md
spec/static/main.js

index d3b3b2e64ddfd6cc6eb4d074c92d9a741f336fb4..dc51711fcdfdd74003a5cee98d801aeb350b656d 100644 (file)
@@ -49,7 +49,7 @@ void App::OnWillFinishLaunching() {
 }
 
 void App::OnFinishLaunching() {
-  Emit("finish-launching");
+  Emit("ready");
 }
 
 // static
index bcc8b7e1951d6bc6852df8fbb26c2efbc57a6500..241498f83fbf958bb92fa63ebf185247ae31748e 100644 (file)
@@ -28,5 +28,8 @@ if process.platform is 'darwin'
     setBadge: bindings.dockSetBadgeText
     getBadge: bindings.dockGetBadgeText
 
+# Support old event name.
+app.once 'ready', -> app.emit 'finish-launching'
+
 # Only one App object pemitted.
 module.exports = app
index 092a193326a837d7385b2118e43950dd1eaf77cb..42b5fa60520ddff6725554f3c316b2199c41727a 100644 (file)
@@ -17,7 +17,7 @@ app.on('open-url', function(event, url) {
   dialog.showMessageBox({message: url, buttons: ['OK']});
 });
 
-app.on('finish-launching', function() {
+app.on('ready', function() {
   app.commandLine.appendSwitch('js-flags', '--harmony_collections');
 
   mainWindow = new BrowserWindow({ width: 800, height: 600 });
index e57df1a3cdd98e25eae97c366d8326ef46d25fe3..ae2ec9da61523bc13da8ec1f3708e8949673a012 100644 (file)
@@ -13,11 +13,17 @@ app.on('window-all-closed', function() {
 
 ## Event: will-finish-launching
 
-Setup crash reporter and auto updater here.
+Emitted when application has done basic startup. On Windows and Linux it is the
+same with `ready` event, on OS X this event represents the
+`applicationWillFinishLaunching` message of `NSApplication`, usually you would
+setup listeners to `open-file` and `open-url` events here, and start the crash
+reporter and auto updater.
 
-## Event: finish-launching
+Under most cases you should just do everything in `ready` event.
 
-Do final startup like creating browser window here.
+## Event: ready
+
+Emitted when atom-shell has done everything initializaiton.
 
 ## Event: window-all-closed
 
index eb0b3cbf5d3e9b1c9daf55a61e3f66c0be81e200..82521071465c560e275db8f945cb40fe6de1eb01 100644 (file)
@@ -66,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.
-app.on('finish-launching', function() {
+app.on('ready', function() {
   // Create the browser window,
   mainWindow = new Window({ width: 800, height: 600 });
   // and load the index.html of the app.
index 1f77bb13b8d78df37958691124b23bc794e11931..674775c712f976e438220ec29250a8b7ddeb5495 100644 (file)
@@ -40,7 +40,7 @@ app.on('window-all-closed', function() {
   app.terminate();
 });
 
-app.on('finish-launching', function() {
+app.on('ready', function() {
   var template = [
     {
       label: 'Atom',