domOutput.js 421 B

123456789101112131415161718192021
  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("\n", '</br>');
  10. text = text.replace(/\t/g,'&#9;');
  11. const span = $('<span />').addClass('ivprog-io-output-text').html(text);
  12. this.el.append(span);
  13. }
  14. clear () {
  15. this.el.empty();
  16. }
  17. }