socket-function 0.12.10 → 0.12.11
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.
- package/SocketFunction.ts +6 -3
- package/package.json +1 -1
package/SocketFunction.ts
CHANGED
|
@@ -15,11 +15,13 @@ import { JSONLACKS } from "./src/JSONLACKS/JSONLACKS";
|
|
|
15
15
|
import "./SetProcessVariables";
|
|
16
16
|
import cborx from "cbor-x";
|
|
17
17
|
import { setFlag } from "./require/compileFlags";
|
|
18
|
-
import { shimDateNow, waitForFirstTimeSync } from "./time/trueTimeShim";
|
|
19
18
|
import { isNode } from "./src/misc";
|
|
20
19
|
|
|
21
20
|
/** Always shim Date.now(), because we usually DO want an accurate time... */
|
|
22
|
-
|
|
21
|
+
setImmediate(async () => {
|
|
22
|
+
const { shimDateNow } = await import("./time/trueTimeShim");
|
|
23
|
+
shimDateNow();
|
|
24
|
+
});
|
|
23
25
|
|
|
24
26
|
setFlag(require, "cbor-x", "allowclient", true);
|
|
25
27
|
let cborxInstance = new cborx.Encoder({ structuredClone: true });
|
|
@@ -247,6 +249,7 @@ export class SocketFunction {
|
|
|
247
249
|
this.mountedIP = config.ip;
|
|
248
250
|
}
|
|
249
251
|
|
|
252
|
+
const { waitForFirstTimeSync } = await import("./time/trueTimeShim");
|
|
250
253
|
await waitForFirstTimeSync();
|
|
251
254
|
|
|
252
255
|
// Wait for any additionals functions to expose themselves
|
|
@@ -291,7 +294,7 @@ export class SocketFunction {
|
|
|
291
294
|
}
|
|
292
295
|
|
|
293
296
|
public static browserNodeId() {
|
|
294
|
-
if (
|
|
297
|
+
if (isNode()) {
|
|
295
298
|
throw new Error("Cannot get browser nodeId on server");
|
|
296
299
|
}
|
|
297
300
|
return SocketFunction.connect({ address: location.hostname, port: +location.port || 443 });
|