@webview-bridge/web 1.3.3 → 1.4.0-nightly.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.
- package/dist/commonjs/index.cjs +15 -3
- package/dist/module/index.mjs +15 -3
- package/dist/typescript/packages/web/src/internal/emitter.d.ts +1 -0
- package/dist/typescript/packages/web/src/{linkBridgeStore.d.ts → internal/linkBridgeStore.d.ts} +1 -1
- package/package.json +4 -9
- package/dist/typescript/packages/web/src/emitter.d.ts +0 -1
package/dist/commonjs/index.cjs
CHANGED
|
@@ -137,6 +137,10 @@ var equals = (a, b) => {
|
|
|
137
137
|
return a !== a && b !== b;
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
+
// ../../shared/util/src/noop.ts
|
|
141
|
+
var noop = () => {
|
|
142
|
+
};
|
|
143
|
+
|
|
140
144
|
// ../../shared/util/src/removeUndefinedKeys.tsx
|
|
141
145
|
var removeUndefinedKeys = (obj) => {
|
|
142
146
|
Object.keys(obj).forEach((key) => {
|
|
@@ -160,10 +164,10 @@ var timeout = (ms, throwOnError = true) => {
|
|
|
160
164
|
});
|
|
161
165
|
};
|
|
162
166
|
|
|
163
|
-
// src/emitter.ts
|
|
167
|
+
// src/internal/emitter.ts
|
|
164
168
|
var emitter = createEvents();
|
|
165
169
|
|
|
166
|
-
// src/linkBridgeStore.ts
|
|
170
|
+
// src/internal/linkBridgeStore.ts
|
|
167
171
|
var linkBridgeStore = (initialState = {}) => {
|
|
168
172
|
if (!window.ReactNativeWebView) {
|
|
169
173
|
console.warn("[WebViewBridge] Not in a WebView environment");
|
|
@@ -238,6 +242,14 @@ var linkBridge = (options = {
|
|
|
238
242
|
timeout: 2e3,
|
|
239
243
|
throwOnError: false
|
|
240
244
|
}) => {
|
|
245
|
+
if (typeof window === "undefined") {
|
|
246
|
+
return {
|
|
247
|
+
store: {
|
|
248
|
+
getState: () => ({}),
|
|
249
|
+
subscribe: noop
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
241
253
|
const {
|
|
242
254
|
timeout: timeoutMs = 2e3,
|
|
243
255
|
throwOnError = false,
|
|
@@ -327,7 +339,7 @@ var linkNativeMethod = (options = {
|
|
|
327
339
|
|
|
328
340
|
// src/registerWebMethod.ts
|
|
329
341
|
var registerWebMethod = (bridge) => {
|
|
330
|
-
if (!window.ReactNativeWebView) {
|
|
342
|
+
if (typeof window !== "undefined" && !window.ReactNativeWebView) {
|
|
331
343
|
console.warn("[WebViewBridge] Not in a WebView environment");
|
|
332
344
|
return bridge;
|
|
333
345
|
}
|
package/dist/module/index.mjs
CHANGED
|
@@ -107,6 +107,10 @@ var equals = (a, b) => {
|
|
|
107
107
|
return a !== a && b !== b;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
+
// ../../shared/util/src/noop.ts
|
|
111
|
+
var noop = () => {
|
|
112
|
+
};
|
|
113
|
+
|
|
110
114
|
// ../../shared/util/src/removeUndefinedKeys.tsx
|
|
111
115
|
var removeUndefinedKeys = (obj) => {
|
|
112
116
|
Object.keys(obj).forEach((key) => {
|
|
@@ -130,10 +134,10 @@ var timeout = (ms, throwOnError = true) => {
|
|
|
130
134
|
});
|
|
131
135
|
};
|
|
132
136
|
|
|
133
|
-
// src/emitter.ts
|
|
137
|
+
// src/internal/emitter.ts
|
|
134
138
|
var emitter = createEvents();
|
|
135
139
|
|
|
136
|
-
// src/linkBridgeStore.ts
|
|
140
|
+
// src/internal/linkBridgeStore.ts
|
|
137
141
|
var linkBridgeStore = (initialState = {}) => {
|
|
138
142
|
if (!window.ReactNativeWebView) {
|
|
139
143
|
console.warn("[WebViewBridge] Not in a WebView environment");
|
|
@@ -208,6 +212,14 @@ var linkBridge = (options = {
|
|
|
208
212
|
timeout: 2e3,
|
|
209
213
|
throwOnError: false
|
|
210
214
|
}) => {
|
|
215
|
+
if (typeof window === "undefined") {
|
|
216
|
+
return {
|
|
217
|
+
store: {
|
|
218
|
+
getState: () => ({}),
|
|
219
|
+
subscribe: noop
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
211
223
|
const {
|
|
212
224
|
timeout: timeoutMs = 2e3,
|
|
213
225
|
throwOnError = false,
|
|
@@ -297,7 +309,7 @@ var linkNativeMethod = (options = {
|
|
|
297
309
|
|
|
298
310
|
// src/registerWebMethod.ts
|
|
299
311
|
var registerWebMethod = (bridge) => {
|
|
300
|
-
if (!window.ReactNativeWebView) {
|
|
312
|
+
if (typeof window !== "undefined" && !window.ReactNativeWebView) {
|
|
301
313
|
console.warn("[WebViewBridge] Not in a WebView environment");
|
|
302
314
|
return bridge;
|
|
303
315
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const emitter: import("../../../../shared/util/src").EventEmitter<import("../../../../shared/util/src").DefaultEvents>;
|
package/dist/typescript/packages/web/src/{linkBridgeStore.d.ts → internal/linkBridgeStore.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bridge, BridgeStore, OnlyJSON } from "
|
|
1
|
+
import { Bridge, BridgeStore, OnlyJSON } from "../../../../shared/util/src/types";
|
|
2
2
|
export type Store<BridgeObject extends Bridge> = ({ get, set, }: {
|
|
3
3
|
get: () => BridgeObject;
|
|
4
4
|
set: (newState: Partial<OnlyJSON<BridgeObject>>) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webview-bridge/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0-nightly.0",
|
|
5
5
|
"description": "Fully Type-Safe Integration for React Native WebView and Web",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -20,14 +20,9 @@
|
|
|
20
20
|
"types": "dist/typescript/packages/web/src/index.d.ts",
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
"import": {
|
|
28
|
-
"default": "./dist/module/index.mjs",
|
|
29
|
-
"types": "./dist/typescript/packages/web/src/index.d.ts"
|
|
30
|
-
}
|
|
23
|
+
"types": "./dist/typescript/packages/web/src/index.d.ts",
|
|
24
|
+
"import": "./dist/module/index.mjs",
|
|
25
|
+
"require": "./dist/commonjs/index.cjs"
|
|
31
26
|
}
|
|
32
27
|
},
|
|
33
28
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const emitter: import("../../../shared/util/src").EventEmitter<import("../../../shared/util/src").DefaultEvents>;
|