Skip to content

Commit 9435a16

Browse files
committed
fixes(adding the license and correcting the spaces)
1 parent bbda349 commit 9435a16

File tree

3 files changed

+50
-23
lines changed

3 files changed

+50
-23
lines changed

packages/remote-config/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ export async function setCustomSignals(
354354
);
355355
}
356356
}
357+
357358
/**
358359
* Registers a real-time listener for Remote Config updates.
359360
*
Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,55 @@
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
117

218
import { ConfigUpdateObserver } from "../public_types";
3-
export class RealtimeHandler {
4-
constructor() {
19+
const MAX_HTTP_RETRIES = 8;
520

6-
}
21+
export class RealtimeHandler{
22+
constructor ()
23+
{ }
24+
725
private observers: Set<ConfigUpdateObserver> = new Set<ConfigUpdateObserver>();
8-
begineRealtime(){
9-
//if observers are present, start the realtime updates
10-
if (this.observers.size > 0) {
11-
12-
}
13-
}
26+
1427
/**
15-
* Adds an observer to the realtime updates.
16-
* @param observer The observer to add.
17-
*/
18-
addObserver(observer: ConfigUpdateObserver) {
28+
* Adds an observer to the realtime updates.
29+
* @param observer The observer to add.
30+
*/
31+
public addObserver(observer: ConfigUpdateObserver) {
1932
this.observers.add(observer);
20-
console.log("observer added:", this.observers);
21-
22-
this.begineRealtime();
33+
this.beginRealtime();
2334
}
2435
/**
2536
* Removes an observer from the realtime updates.
2637
* @param observer The observer to remove.
27-
* @returns true if the observer was removed, false if it was not found.
2838
*/
29-
removeObserver(observer: ConfigUpdateObserver) {
39+
public removeObserver(observer: ConfigUpdateObserver): void {
3040
if (this.observers.has(observer)) {
31-
console.log("observer remove:", this.observers);
32-
return this.observers.delete(observer);
41+
this.observers.delete(observer);
3342
}
3443
}
44+
45+
private beginRealtime(): void {
46+
if (this.observers.size > 0) {
47+
this.makeRealtimeHttpConnection(0);
48+
}
49+
}
50+
51+
private makeRealtimeHttpConnection(retryMilliseconds: number): void {
52+
53+
}
54+
3555
}

packages/remote-config/src/public_types.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,19 @@ declare module '@firebase/component' {
223223
* @public
224224
*/
225225
export interface ConfigUpdateObserver {
226-
// Called when a new ConfigUpdate is available.
226+
/**
227+
* Called when a new ConfigUpdate is available.
228+
*/
227229
next: (configUpdate: ConfigUpdate) => void;
228230

229-
// Called if an error occurs during the stream.
231+
/**
232+
* Called if an error occurs during the stream.
233+
*/
230234
error: (error: FirebaseError) => void;
231235

232-
// Called when the stream is gracefully terminated.
236+
/**
237+
* Called when the stream is gracefully terminated.
238+
*/
233239
complete: () => void;
234240
}
235241

0 commit comments

Comments
 (0)