2022-01-07 22:09:52 -05:00
|
|
|
// Copyright 2018-2022 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;
|
2022-08-11 09:56:56 -04:00
|
|
|
const ops = core.ops;
|
2020-07-19 13:49:44 -04:00
|
|
|
|
|
|
|
function consoleSize(rid) {
|
2022-08-11 09:56:56 -04:00
|
|
|
return ops.op_console_size(rid);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function isatty(rid) {
|
2022-08-11 09:56:56 -04:00
|
|
|
return ops.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 };
|
2022-08-11 09:56:56 -04:00
|
|
|
ops.op_set_raw({ rid, mode, options: rOptions });
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
window.__bootstrap.tty = {
|
|
|
|
consoleSize,
|
|
|
|
isatty,
|
|
|
|
setRaw,
|
|
|
|
};
|
|
|
|
})(this);
|