domOutput.js 397 B

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