@woosh/meep-engine 2.46.31 → 2.46.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,8 @@ import EmptyView from "../../../src/view/elements/EmptyView.js";
8
8
  import { downloadAsFile } from "../../../src/core/binary/ByteArrayTools.js";
9
9
 
10
10
  export async function obtainClipBoard() {
11
+ const navigator = globalThis.navigator;
12
+
11
13
  if (navigator.clipboard === undefined) {
12
14
  const queries = [{
13
15
  name: "clipboard-read"
@@ -41,6 +43,7 @@ export async function safeClipboardWriteText(text, data_name = "data") {
41
43
 
42
44
  return obtainClipBoard().then(
43
45
  () => {
46
+ const navigator = globalThis.navigator;
44
47
  return navigator.clipboard.writeText(text);
45
48
  },
46
49
  () => {
@@ -55,6 +58,7 @@ export async function safeClipboardReadText() {
55
58
 
56
59
  return obtainClipBoard().then(() => {
57
60
 
61
+ const navigator = globalThis.navigator;
58
62
  return navigator.clipboard.readText();
59
63
  }, () => {
60
64
  // clipboard not available
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.46.31",
8
+ "version": "2.46.33",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -9,6 +9,12 @@ function browserInfo() {
9
9
  return cached;
10
10
  }
11
11
 
12
+ const navigator = globalThis.navigator;
13
+
14
+ if(navigator === undefined){
15
+ throw new Error('Not a browser, globalThis.navigator is undefined');
16
+ }
17
+
12
18
  let ua = navigator.userAgent, tem,
13
19
  M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
14
20
 
@@ -990,6 +990,7 @@ function make_box_editor(engine, transform = new Transform()) {
990
990
  const code_snippet = `TransformedShape3D.from_m4(new UnitCubeShape3D(), ${JSON.stringify(cachedObject.matrix.elements)})`;
991
991
  console.warn(code_snippet);
992
992
 
993
+ const navigator = globalThis.navigator;
993
994
  navigator.clipboard.writeText(code_snippet);
994
995
  }
995
996
  },
@@ -53,6 +53,7 @@ const init = async ({ canvasRef, gui }) => {
53
53
  // const mesh = await load_geometry("data/models/stanford/dragon_recon/dragon_vrip.ply");
54
54
  const mesh = await load_geometry_gltf("data/models/stanford/DragonAttenuation.glb");
55
55
 
56
+ const navigator = globalThis.navigator;
56
57
 
57
58
  const adapter = await navigator.gpu.requestAdapter();
58
59
  const device = await adapter.requestDevice();
@@ -649,6 +649,8 @@ function getRandomString() {
649
649
 
650
650
  window.userid = getRandomString();
651
651
 
652
+ const navigator = globalThis.navigator;
653
+
652
654
  const isMobileDevice = navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i);
653
655
  const isChrome = !!navigator.webkitGetUserMedia;
654
656
  const isFirefox = !!navigator.mozGetUserMedia;
@@ -1205,4 +1207,4 @@ function RTCPeerConnection(options) {
1205
1207
  };
1206
1208
  }
1207
1209
 
1208
- export default DataChannel;
1210
+ export default DataChannel;
@@ -196,7 +196,7 @@ function setListenerPositionNOOP(listener, position) {
196
196
 
197
197
  let setListenerPosition = setListenerPositionNOOP;
198
198
 
199
- if (navigator !== undefined) {
199
+ if (globalThis.navigator !== undefined) {
200
200
  const info = browserInfo();
201
201
  if (info.name === "Chrome") {
202
202
  if (info.version >= 64) {
@@ -248,7 +248,7 @@ function setListenerOrientation2(listener, forward, up) {
248
248
 
249
249
  let setListenerOrientation = noop;
250
250
 
251
- if (navigator !== undefined) {
251
+ if (globalThis.navigator !== undefined) {
252
252
  const info = browserInfo();
253
253
  if (info.name === "Chrome") {
254
254
  setListenerOrientation = setListenerOrientation1;