index.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import {
  4. TerminalSession
  5. } from 'jupyter-js-services';
  6. import {
  7. TerminalWidget
  8. } from 'jupyterlab/lib/terminal';
  9. import {
  10. DockPanel
  11. } from 'phosphor/lib/ui/dockpanel';
  12. import {
  13. Widget
  14. } from 'phosphor/lib/ui/widget';
  15. import 'jupyterlab/lib/default-theme/index.css';
  16. import '../index.css';
  17. function main(): void {
  18. let term1 = new TerminalWidget({
  19. background: 'black',
  20. color: 'white'
  21. });
  22. let term2 = new TerminalWidget({
  23. background: 'white',
  24. color: 'black'
  25. });
  26. TerminalSession.open().then(session => term1.session = session);
  27. TerminalSession.open().then(session => term2.session = session);
  28. term1.title.closable = true;
  29. term2.title.closable = true;
  30. let dock = new DockPanel();
  31. dock.addWidget(term1);
  32. dock.addWidget(term2, { mode: 'tab-before' });
  33. Widget.attach(dock, document.body);
  34. dock.id = 'main';
  35. window.onresize = () => dock.fit();
  36. }
  37. window.onload = main;