Skip to content

Commit

Permalink
Support runtime execution under node (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
kungfooman authored Nov 24, 2023
1 parent f31c3d5 commit de0f387
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
33 changes: 20 additions & 13 deletions src-runtime/typecheckTable.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
const typecheckWarnedTable = document.createElement('table');
const tr = document.createElement('tr');
const th_0 = document.createElement('th');
const th_1 = document.createElement('th');
const th_2 = document.createElement('th');
th_0.innerText = 'dbg;';
th_1.innerText = 'Hits';
th_2.innerText = 'Message';
tr.append(th_0, th_1, th_2);
typecheckWarnedTable.append(tr);
//typecheckWarnedTable.style.maxHeight = '200px';
//typecheckWarnedTable.style.overflow = 'scroll';
//typecheckWarnedTable.style.textWrap = 'nowrap';
function createTable() {
if (typeof document === 'undefined') {
return null;
}
const table = document.createElement('table');
const tr = document.createElement('tr');
const th_0 = document.createElement('th');
const th_1 = document.createElement('th');
const th_2 = document.createElement('th');
th_0.innerText = 'dbg;';
th_1.innerText = 'Hits';
th_2.innerText = 'Message';
tr.append(th_0, th_1, th_2);
table.append(tr);
//table.style.maxHeight = '200px';
//table.style.overflow = 'scroll';
//table.style.textWrap = 'nowrap';
return table;
}
const typecheckWarnedTable = createTable();
export {typecheckWarnedTable};
2 changes: 1 addition & 1 deletion src-runtime/validateType.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function validateType(value, expect, loc, name, critical = true) {
return false;
}
}
if (window.pc) {
if (typeof window !== 'undefined' && window.pc) {
const {pc} = window;
/**
* @param {string|number} prop - Something like 'x', 'y', 'z', 'w', 0, 1, 2, 3, 4 etc.
Expand Down

0 comments on commit de0f387

Please sign in to comment.