How to use the xterm.prototype function in xterm

To help you get started, we’ve selected a few xterm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tbodt / ish / app / xtermjs / term.js View on Github external
import Terminal from 'xterm';
import 'xterm/dist/xterm.css';
import './term.css';

// monkey patching so xterm doesn't need a textarea
Terminal.prototype.focus = function() {
    this.textarea.dispatchEvent(new FocusEvent('focus'));
};
Terminal.prototype.blur = function() {
    this.textarea.dispatchEvent(new FocusEvent('blur'));
};

window.term = new Terminal();
// there is no public interface to disable linkifying
term.linkifier._linkMatchers = [];
term.open(document.getElementById('terminal'), true);
term.on('focus', function() {
    webkit.messageHandlers.focus.postMessage('focus');
});
term.on('resize', function(size) {
    webkit.messageHandlers.resize.postMessage('resize');
});

// copied from the fit addon, but without subtracting 17 pixels for a nonexistent scrollbar
function fit() {
github tbodt / ish / app / xtermjs / term.js View on Github external
import Terminal from 'xterm';
import 'xterm/dist/xterm.css';
import './term.css';

// monkey patching so xterm doesn't need a textarea
Terminal.prototype.focus = function() {
    this.textarea.dispatchEvent(new FocusEvent('focus'));
};
Terminal.prototype.blur = function() {
    this.textarea.dispatchEvent(new FocusEvent('blur'));
};

window.term = new Terminal();
// there is no public interface to disable linkifying
term.linkifier._linkMatchers = [];
term.open(document.getElementById('terminal'), true);
term.on('focus', function() {
    webkit.messageHandlers.focus.postMessage('focus');
});
term.on('resize', function(size) {
    webkit.messageHandlers.resize.postMessage('resize');
});