2023-01-02 16:00:42 -05:00
|
|
|
// Copyright 2018-2023 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) => {
|
2022-09-23 00:05:45 -04:00
|
|
|
const {
|
|
|
|
Uint32Array,
|
|
|
|
Uint8Array,
|
|
|
|
} = window.__bootstrap.primordials;
|
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
|
|
|
|
2022-09-23 00:05:45 -04:00
|
|
|
const size = new Uint32Array(2);
|
2022-10-25 18:23:21 -04:00
|
|
|
function consoleSize() {
|
|
|
|
ops.op_console_size(size);
|
2022-09-23 00:05:45 -04:00
|
|
|
return { columns: size[0], rows: size[1] };
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
2022-09-23 00:05:45 -04:00
|
|
|
const isattyBuffer = new Uint8Array(1);
|
2020-07-19 13:49:44 -04:00
|
|
|
function isatty(rid) {
|
2022-09-23 00:05:45 -04:00
|
|
|
ops.op_isatty(rid, isattyBuffer);
|
|
|
|
return !!isattyBuffer[0];
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
window.__bootstrap.tty = {
|
|
|
|
consoleSize,
|
|
|
|
isatty,
|
|
|
|
};
|
|
|
|
})(this);
|