-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2710 from takluyver/initialized_promise
Add a promise for app_initialized event.
- Loading branch information
Showing
4 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
// Give us an object to bind all events to. This object should be created | ||
// before all other objects so it exists when others register event handlers. | ||
// To register an event handler: | ||
// | ||
// require(['base/js/events'], function (events) { | ||
// events.on("event.Namespace", function () { do_stuff(); }); | ||
// }); | ||
|
||
define(['base/js/events', 'base/js/namespace'], function(events, Jupyter) { | ||
"use strict"; | ||
|
||
// Promise to be resolved when the application is initialized. | ||
// The value is the name of the app on the current page. | ||
var app_initialized = new Promise(function(resolve, reject) { | ||
events.on('app_initialized.NotebookApp', function() { | ||
resolve('NotebookApp'); | ||
}); | ||
events.on('app_initialized.DashboardApp', function() { | ||
resolve('DashboardApp'); | ||
}); | ||
}); | ||
|
||
var promises = { | ||
app_initialized: app_initialized | ||
}; | ||
Jupyter.promises = promises; | ||
|
||
return promises; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters