fix node detection in electron environment

pull/356/head
Vladimir Mandic 2021-12-07 17:02:33 -05:00
parent f720159149
commit 67c60a77b7
4 changed files with 11 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.vscode
node_modules
pnpm-lock.yaml
assets/tf*

View File

@ -9,11 +9,11 @@
## Changelog
### **HEAD -> main** 2021/12/01 mandic00@live.com
### **2.5.5** 2021/12/01 mandic00@live.com
### **origin/main** 2021/11/26 mandic00@live.com
- added human-motion
- add offscreencanvas typedefs
- release preview

View File

@ -53,7 +53,7 @@
"tensorflow"
],
"devDependencies": {
"@microsoft/api-extractor": "^7.18.19",
"@microsoft/api-extractor": "^7.18.21",
"@tensorflow/tfjs": "^3.11.0",
"@tensorflow/tfjs-backend-cpu": "^3.11.0",
"@tensorflow/tfjs-backend-wasm": "^3.11.0",
@ -65,17 +65,17 @@
"@tensorflow/tfjs-layers": "^3.11.0",
"@tensorflow/tfjs-node": "^3.11.0",
"@tensorflow/tfjs-node-gpu": "^3.11.0",
"@types/node": "^16.11.11",
"@types/node": "^16.11.12",
"@types/offscreencanvas": "^2019.6.4",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"@vladmandic/build": "^0.6.6",
"@vladmandic/pilogger": "^0.3.5",
"@vladmandic/tfjs": "github:vladmandic/tfjs",
"canvas": "^2.8.0",
"dayjs": "^1.10.7",
"esbuild": "^0.14.1",
"eslint": "8.3.0",
"esbuild": "^0.14.2",
"eslint": "8.4.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.25.3",

View File

@ -80,7 +80,7 @@ export class Env {
constructor() {
this.browser = typeof navigator !== 'undefined';
this.node = typeof process !== 'undefined';
this.node = (typeof process !== 'undefined') && (typeof process.versions !== 'undefined') && (typeof process.versions.node !== 'undefined');
this.tfjs = { version: tf.version['tfjs-core'] };
this.offscreen = typeof OffscreenCanvas !== 'undefined';
this.initial = true;