promises.js 816 B

1234567891011121314151617181920212223242526
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. // Define an object to attach promises to for one-time events.
  4. define(['base/js/events', 'base/js/namespace'], function(events, Jupyter) {
  5. "use strict";
  6. // Promise to be resolved when the application is initialized.
  7. // The value is the name of the app on the current page.
  8. var app_initialized = new Promise(function(resolve, reject) {
  9. events.on('app_initialized.NotebookApp', function() {
  10. resolve('NotebookApp');
  11. });
  12. events.on('app_initialized.DashboardApp', function() {
  13. resolve('DashboardApp');
  14. });
  15. });
  16. var promises = {
  17. app_initialized: app_initialized
  18. };
  19. Jupyter.promises = promises;
  20. return promises;
  21. });