MCPcopy Create free account
hub / github.com/JavaCS3/xterm-player / createTerminal

Function createTerminal

src/Player.ts:18–37  ·  view source on GitHub ↗
(options: IPlayerOptions)

Source from the content-addressed store, hash-verified

16}
17
18function createTerminal(options: IPlayerOptions): xterm.Terminal {
19 const opts: xterm.ITerminalOptions = {
20 fontSize: options.fontSize || 15,
21 fontFamily: options.fontFamily || 'Consolas, Menlo',
22 fontWeight: options.fontWeight || 'normal',
23 fontWeightBold: options.fontWeightBold || 'bold',
24 theme: options.theme || {},
25 }
26
27 // Workaround: xterm.js only supports browser env via global variable Terminal,
28 // which is different from typescript usage.
29 // Use constructor from window.Terminal if it's browser env
30 if (xterm.Terminal) {
31 return new xterm.Terminal(opts)
32 }
33 if (window) {
34 return new window.Terminal(opts)
35 }
36 throw new Error('Cannot create xterm Terminal object')
37}
38
39export class XtermPlayer implements XtermPlayerApi {
40 static readonly THEME_SOLARIZED_DARK: xterm.ITheme = SOLARIZED_DARK

Callers 1

constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected