@devvit/public-api 0.10.23-next-2024-06-18-ac263ba60.0 → 0.10.23-next-2024-06-18-20e2f750d.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useChannel.d.ts","sourceRoot":"","sources":["../../../../src/devvit/internals/blocks/useChannel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,gBAAgB,GAAG,cAAc,
|
1
|
+
{"version":3,"file":"useChannel.d.ts","sourceRoot":"","sources":["../../../../src/devvit/internals/blocks/useChannel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,gBAAgB,GAAG,cAAc,CAoH/E"}
|
@@ -5,7 +5,6 @@ import { Hook } from '../../../types/hooks.js';
|
|
5
5
|
import { ChannelStatus } from '../../../types/realtime.js';
|
6
6
|
export function makeUseChannelHook(reconciler) {
|
7
7
|
function useChannel(options) {
|
8
|
-
const debug = false;
|
9
8
|
const hookIndex = reconciler.currentHookIndex;
|
10
9
|
const currentState = reconciler.getCurrentComponentState();
|
11
10
|
const previousState = reconciler.getPreviousComponentState();
|
@@ -14,8 +13,6 @@ export function makeUseChannelHook(reconciler) {
|
|
14
13
|
const installationId = reconciler.metadata[Header.Installation]?.values[0];
|
15
14
|
assertNonNull(installationId, 'useChannel - installation is missing from Context');
|
16
15
|
async function send(data) {
|
17
|
-
if (debug)
|
18
|
-
console.debug('[realtime] sends', data);
|
19
16
|
const name = currentState[hookIndex].channel;
|
20
17
|
if (currentState[hookIndex].active) {
|
21
18
|
if (currentState[hookIndex].connected) {
|
@@ -31,8 +28,6 @@ export function makeUseChannelHook(reconciler) {
|
|
31
28
|
}
|
32
29
|
function subscribe() {
|
33
30
|
if (!currentState[hookIndex].active) {
|
34
|
-
if (debug)
|
35
|
-
console.debug('[realtime] subscribe');
|
36
31
|
const name = currentState[hookIndex].channel;
|
37
32
|
currentState[hookIndex].active = true;
|
38
33
|
reconciler.addRealtimeChannel(name);
|
@@ -40,8 +35,6 @@ export function makeUseChannelHook(reconciler) {
|
|
40
35
|
}
|
41
36
|
function unsubscribe() {
|
42
37
|
if (currentState[hookIndex].active) {
|
43
|
-
if (debug)
|
44
|
-
console.debug('[realtime] unsubscribe');
|
45
38
|
const name = currentState[hookIndex].channel;
|
46
39
|
currentState[hookIndex].active = false;
|
47
40
|
reconciler.removeRealtimeChannel(name);
|
@@ -52,20 +45,14 @@ export function makeUseChannelHook(reconciler) {
|
|
52
45
|
let result;
|
53
46
|
switch (event.status) {
|
54
47
|
case RealtimeSubscriptionStatus.REALTIME_SUBSCRIBED:
|
55
|
-
if (debug)
|
56
|
-
console.debug('[realtime] onSubscribed()');
|
57
48
|
currentState[hookIndex].connected = true;
|
58
49
|
result = options.onSubscribed?.();
|
59
50
|
break;
|
60
51
|
case RealtimeSubscriptionStatus.REALTIME_UNSUBSCRIBED:
|
61
|
-
if (debug)
|
62
|
-
console.debug('[realtime] onUnsubscribed()');
|
63
52
|
currentState[hookIndex].connected = false;
|
64
53
|
result = options.onUnsubscribed?.();
|
65
54
|
break;
|
66
55
|
default:
|
67
|
-
if (debug)
|
68
|
-
console.debug('[realtime] receives', event.event?.data);
|
69
56
|
result = options.onMessage(event.event?.data ?? {});
|
70
57
|
break;
|
71
58
|
}
|
package/meta.json
CHANGED
@@ -11378,7 +11378,7 @@
|
|
11378
11378
|
"format": "esm"
|
11379
11379
|
},
|
11380
11380
|
"src/devvit/internals/blocks/useChannel.ts": {
|
11381
|
-
"bytes":
|
11381
|
+
"bytes": 4381,
|
11382
11382
|
"imports": [
|
11383
11383
|
{
|
11384
11384
|
"path": "../protos/dist/index.js",
|
@@ -14317,7 +14317,7 @@
|
|
14317
14317
|
"bytesInOutput": 1181
|
14318
14318
|
},
|
14319
14319
|
"src/devvit/internals/blocks/useChannel.ts": {
|
14320
|
-
"bytesInOutput":
|
14320
|
+
"bytesInOutput": 3627
|
14321
14321
|
},
|
14322
14322
|
"src/apis/ui/helpers/getFormValues.ts": {
|
14323
14323
|
"bytesInOutput": 723
|
@@ -14539,7 +14539,7 @@
|
|
14539
14539
|
"bytesInOutput": 4450
|
14540
14540
|
}
|
14541
14541
|
},
|
14542
|
-
"bytes":
|
14542
|
+
"bytes": 15005257
|
14543
14543
|
}
|
14544
14544
|
}
|
14545
14545
|
}
|
package/meta.min.json
CHANGED
@@ -2608,7 +2608,7 @@
|
|
2608
2608
|
"format": "esm"
|
2609
2609
|
},
|
2610
2610
|
"src/devvit/internals/blocks/useChannel.ts": {
|
2611
|
-
"bytes":
|
2611
|
+
"bytes": 4381,
|
2612
2612
|
"imports": [
|
2613
2613
|
{
|
2614
2614
|
"path": "@devvit/protos",
|
@@ -4657,7 +4657,7 @@
|
|
4657
4657
|
"imports": [],
|
4658
4658
|
"exports": [],
|
4659
4659
|
"inputs": {},
|
4660
|
-
"bytes":
|
4660
|
+
"bytes": 1145437
|
4661
4661
|
},
|
4662
4662
|
"dist/public-api.min.js": {
|
4663
4663
|
"imports": [
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@devvit/public-api",
|
3
|
-
"version": "0.10.23-next-2024-06-18-
|
3
|
+
"version": "0.10.23-next-2024-06-18-20e2f750d.0",
|
4
4
|
"license": "BSD-3-Clause",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -30,8 +30,8 @@
|
|
30
30
|
},
|
31
31
|
"types": "./index.d.ts",
|
32
32
|
"dependencies": {
|
33
|
-
"@devvit/protos": "0.10.23-next-2024-06-18-
|
34
|
-
"@devvit/shared-types": "0.10.23-next-2024-06-18-
|
33
|
+
"@devvit/protos": "0.10.23-next-2024-06-18-20e2f750d.0",
|
34
|
+
"@devvit/shared-types": "0.10.23-next-2024-06-18-20e2f750d.0",
|
35
35
|
"base64-js": "1.5.1",
|
36
36
|
"clone-deep": "4.0.1",
|
37
37
|
"core-js": "3.27.2",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"@ampproject/filesize": "4.3.0",
|
42
42
|
"@devvit/eslint-config": "0.10.22",
|
43
43
|
"@devvit/repo-tools": "0.10.22",
|
44
|
-
"@devvit/tsconfig": "0.10.23-next-2024-06-18-
|
44
|
+
"@devvit/tsconfig": "0.10.23-next-2024-06-18-20e2f750d.0",
|
45
45
|
"@microsoft/api-extractor": "7.41.0",
|
46
46
|
"@reddit/faceplate-ui": "11.3.3",
|
47
47
|
"@types/clone-deep": "4.0.1",
|
@@ -64,5 +64,5 @@
|
|
64
64
|
}
|
65
65
|
},
|
66
66
|
"source": "./src/index.ts",
|
67
|
-
"gitHead": "
|
67
|
+
"gitHead": "36db8d8381a44f43f0daec46ceacc9f95554bb49"
|
68
68
|
}
|