@rpcbase/client 0.84.0 → 0.85.0

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.
@@ -14,7 +14,10 @@ import {POSTHOG_KEY} from "env"
14
14
  const AnalyticsWrapper = ({children, ...props}) => {
15
15
 
16
16
  const {hostname} = window.location
17
- if (__DEV__ || hostname === "localhost" || hostname.endsWith(".local")) {
17
+
18
+ const hasPostHogKey = !!POSTHOG_KEY
19
+
20
+ if (__DEV__ || hostname === "localhost" || hostname.endsWith(".local") || !hasPostHogKey) {
18
21
  return (
19
22
  <>{children}</>
20
23
  )
@@ -0,0 +1,15 @@
1
+ /* @flow */
2
+
3
+ const onReady = (callback) => {
4
+ if (["interactive", "complete"].includes(document.readyState)) {
5
+ callback()
6
+ } else if (document.readyState === "loading") {
7
+ window.addEventListener("DOMContentLoaded", () => {
8
+ callback()
9
+ })
10
+ } else {
11
+ throw new Error("unknown ready state, cannot initialize")
12
+ }
13
+ }
14
+
15
+ export default onReady
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.84.0",
3
+ "version": "0.85.0",
4
4
  "scripts": {
5
5
  "build-firebase": "webpack -c firebase/webpack.config.js",
6
6
  "build": "yarn build-firebase",