domOutput.js 491 B

1234567891011121314151617181920212223
  1. import { Output } from './output';
  2. import $ from 'jquery';
  3. export class DOMOutput extends Output {
  4. constructor (selector) {
  5. super();
  6. this.el = $(selector);
  7. }
  8. sendOutput (text) {
  9. text = text.replace(/^"/, '');
  10. text = text.replace(/"$/, '');
  11. text = text.replace("\n", '</br>');
  12. text = text.replace(/\t/g,'&#9;');
  13. const span = $('<span />').addClass('ivprog-io-output-text').html(text);
  14. this.el.append(span);
  15. }
  16. clear () {
  17. this.el.empty();
  18. }
  19. }