index.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import 'es6-promise/auto'; // polyfill Promise on IE
  4. import '@jupyterlab/theme-light-extension/static/embed.css';
  5. import '../index.css';
  6. import { DockPanel, Widget } from '@phosphor/widgets';
  7. import { TerminalSession } from '@jupyterlab/services';
  8. import { Terminal } from '@jupyterlab/terminal';
  9. function main(): void {
  10. let term1 = new Terminal({ theme: 'light' });
  11. let term2 = new Terminal({ theme: 'dark' });
  12. TerminalSession.startNew().then(session => {
  13. term1.session = session;
  14. });
  15. TerminalSession.startNew().then(session => {
  16. term2.session = session;
  17. });
  18. term1.title.closable = true;
  19. term2.title.closable = true;
  20. let dock = new DockPanel();
  21. dock.addWidget(term1);
  22. dock.addWidget(term2, { mode: 'tab-before' });
  23. dock.id = 'main';
  24. // Attach the widget to the dom.
  25. Widget.attach(dock, document.body);
  26. // Handle resize events.
  27. window.addEventListener('resize', () => {
  28. dock.fit();
  29. });
  30. }
  31. window.addEventListener('load', main);