Skip to content

Commit

Permalink
attach custom formatter on globalThis to enable Node.js devtool; tag …
Browse files Browse the repository at this point in the history
…0.8.42
  • Loading branch information
tiye committed Mar 17, 2024
1 parent 27d37c7 commit e71bf72
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "calcit"
version = "0.8.41"
version = "0.8.42"
authors = ["jiyinyiyong <jiyinyiyong@gmail.com>"]
edition = "2021"
license = "MIT"
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@calcit/procs",
"version": "0.8.41",
"version": "0.8.42",
"main": "./lib/calcit.procs.mjs",
"devDependencies": {
"@types/node": "^20.11.8",
"typescript": "^5.3.3"
"@types/node": "^20.11.28",
"typescript": "^5.4.2"
},
"scripts": {
"compile": "rm -rfv lib/* && tsc",
Expand Down
17 changes: 8 additions & 9 deletions ts-src/custom-formatter.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import { CalcitTuple } from "./js-tuple.mjs";
import { CalcitCirruQuote } from "./js-cirru.mjs";

declare global {
interface Window {
devtoolsFormatters: {
header: (obj: any, config: any) => any[];
hasBody: (obj: any) => boolean;
body: (obj: any, config: any) => any[];
}[];
}
// https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html
var devtoolsFormatters: {
header: (obj: any, config: any) => any[];
hasBody: (obj: any) => boolean;
body: (obj: any, config: any) => any[];
}[];
}

let embedObject = (x: CalcitValue) => {
Expand Down Expand Up @@ -94,8 +93,8 @@ let saveString = (v: CalcitValue) => {
};

export let load_console_formatter_$x_ = () => {
if (typeof window === "object") {
window["devtoolsFormatters"] = [
if (typeof globalThis === "object") {
globalThis["devtoolsFormatters"] = [
{
header: (obj, config) => {
if (obj instanceof CalcitTag) {
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e71bf72

Please sign in to comment.