spinner.ts 831 B

1234567891011121314151617181920212223242526272829303132
  1. /* -----------------------------------------------------------------------------
  2. | Copyright (c) Jupyter Development Team.
  3. | Distributed under the terms of the Modified BSD License.
  4. |----------------------------------------------------------------------------*/
  5. import { Message } from '@lumino/messaging';
  6. import { Widget } from '@lumino/widgets';
  7. /**
  8. * The spinner class.
  9. */
  10. export class Spinner extends Widget {
  11. /**
  12. * Construct a spinner widget.
  13. */
  14. constructor() {
  15. super();
  16. this.addClass('jp-Spinner');
  17. this.node.tabIndex = -1;
  18. const content = document.createElement('div');
  19. content.className = 'jp-SpinnerContent';
  20. this.node.appendChild(content);
  21. }
  22. /**
  23. * Handle `'activate-request'` messages.
  24. */
  25. protected onActivateRequest(msg: Message): void {
  26. this.node.focus();
  27. }
  28. }