(prefix: DataPrefix, suffix: string, field: string)
| 99 | } |
| 100 | |
| 101 | private _subscribe(prefix: DataPrefix, suffix: string, field: string) { |
| 102 | const fullKey = getFullKey(prefix, suffix, field); |
| 103 | |
| 104 | if (this.subscriptions.has(fullKey)) { |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | this._logger.sub('subscribe').info(fullKey); |
| 109 | |
| 110 | this.subscriptions.add(fullKey); |
| 111 | |
| 112 | if (!internals.realtime.isSynced(prefix as any, suffix, field)) { |
| 113 | internals.realtime.pending.set(fullKey, new Resolvable()); |
| 114 | this.pending.add(fullKey); |
| 115 | } |
| 116 | |
| 117 | internals.realtime.subscriptions[fullKey] ??= new Set(); |
| 118 | internals.realtime.subscriptions[fullKey].add(this); |
| 119 | |
| 120 | if (internals.realtime.subscriptions[fullKey].size === 1) { |
| 121 | internals.realtime.pushCommand({ |
| 122 | type: RealtimeCommandType.SUBSCRIBE, |
| 123 | args: [prefix, suffix, field], |
| 124 | }); |
| 125 | } |
| 126 | } |
| 127 | unsubscribe(prefix: DataPrefix, suffix: string, field: string) { |
| 128 | const fullKey = getFullKey(prefix, suffix, field); |
| 129 |
no test coverage detected