2021-01-10 21:59:07 -05:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
2021-02-04 17:18:32 -05:00
|
|
|
"use strict";
|
2020-07-19 13:49:44 -04:00
|
|
|
|
|
|
|
((window) => {
|
2020-09-16 16:22:43 -04:00
|
|
|
const core = window.Deno.core;
|
2020-07-19 13:49:44 -04:00
|
|
|
|
|
|
|
function consoleSize(rid) {
|
2021-04-12 15:55:05 -04:00
|
|
|
return core.opSync("op_console_size", rid);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function isatty(rid) {
|
2021-04-12 15:55:05 -04:00
|
|
|
return core.opSync("op_isatty", rid);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
2020-11-30 11:08:03 -05:00
|
|
|
const DEFAULT_SET_RAW_OPTIONS = {
|
|
|
|
cbreak: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
function setRaw(rid, mode, options = {}) {
|
|
|
|
const rOptions = { ...DEFAULT_SET_RAW_OPTIONS, ...options };
|
2021-04-12 15:55:05 -04:00
|
|
|
core.opSync("op_set_raw", { rid, mode, options: rOptions });
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
window.__bootstrap.tty = {
|
|
|
|
consoleSize,
|
|
|
|
isatty,
|
|
|
|
setRaw,
|
|
|
|
};
|
|
|
|
})(this);
|