@momo2555/koppeliajs 0.0.162 → 0.0.164

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.
@@ -1,5 +1,9 @@
1
1
  import { Console } from "./console.js";
2
2
  import type { MediaResponseData } from "./console.js";
3
+ /**
4
+ * Represents a "Play" (a specific game session or scenario instance).
5
+ * Manages the play's metadata, thumbnail, and the dynamic loading of its core content from the network.
6
+ */
3
7
  export declare class Play {
4
8
  private _playCreationDate;
5
9
  private _playCreatorId;
@@ -14,35 +18,73 @@ export declare class Play {
14
18
  private _refreshed;
15
19
  private _playContent;
16
20
  private _playContentLoaded;
21
+ /**
22
+ * Initializes a new Play instance.
23
+ * @param console The Console instance used for network and media requests.
24
+ * @param playId The unique identifier for this play.
25
+ * @param playRawObj A raw dictionary containing the play's basic metadata.
26
+ */
17
27
  constructor(console: Console, playId: string, playRawObj: {
18
28
  [key: string]: any;
19
29
  });
30
+ /**
31
+ * Constructs the relative path for a media file associated with this play.
32
+ * @param mediaName The name of the media file.
33
+ * @returns The relative media path string.
34
+ */
20
35
  getPlayMediaPath(mediaName: string): string;
36
+ /**
37
+ * Generates the fully qualified URL to access a specific play media file.
38
+ * @param mediaName The name of the media file.
39
+ * @returns The full URL string.
40
+ */
21
41
  getMediaLink(mediaName: string): string;
42
+ /**
43
+ * Asynchronously fetches the raw binary or parsed content of a specific media file.
44
+ * @param mediaName The name of the media file to fetch.
45
+ * @returns A promise resolving to the parsed media data (Blob, JSON, Text, etc.).
46
+ */
22
47
  getMediaContent(mediaName: string): Promise<MediaResponseData>;
48
+ /**
49
+ * Asynchronously fetches the core data payload of the play using its registered file name.
50
+ * @returns A promise resolving to the play's main data object.
51
+ */
23
52
  getMediaData(): Promise<{
24
53
  [key: string]: any;
25
54
  }>;
55
+ /**
56
+ * Downloads and caches the main content of the play into memory, marking it as loaded.
57
+ */
26
58
  updatePlayContent(): Promise<void>;
59
+ /**
60
+ * Gets the loaded content dictionary of the play.
61
+ */
27
62
  get playContent(): {
28
63
  [key: string]: any;
29
64
  };
65
+ /**
66
+ * Checks if the play's main content has been fully loaded into memory.
67
+ * @returns True if the content is loaded, false otherwise.
68
+ */
30
69
  isPlayContentLoaded(): boolean;
31
70
  /**
32
- * Get the data of the play
71
+ * Retrieves the file name serving as the main data entry point for the play.
33
72
  */
34
73
  get data(): string;
35
74
  /**
36
- * Get the id of the play
75
+ * Retrieves the unique identifier of the play.
37
76
  */
38
77
  get id(): string;
39
78
  /**
40
- * Get the name of the play
79
+ * Retrieves the name of the play.
41
80
  */
42
81
  get name(): string;
43
82
  /**
44
- * Get the image base64
83
+ * Retrieves the Base64 encoded thumbnail image of the play.
45
84
  */
46
85
  get image(): string;
86
+ /**
87
+ * Checks if the play data is currently in a refreshed state.
88
+ */
47
89
  get isRefreshed(): boolean;
48
90
  }
@@ -1,5 +1,9 @@
1
1
  import { Console } from "./console.js";
2
2
  import { Message, PeerType } from "./message.js";
3
+ /**
4
+ * Represents a "Play" (a specific game session or scenario instance).
5
+ * Manages the play's metadata, thumbnail, and the dynamic loading of its core content from the network.
6
+ */
3
7
  export class Play {
4
8
  _playCreationDate = "";
5
9
  _playCreatorId = "";
@@ -14,6 +18,12 @@ export class Play {
14
18
  _refreshed = true;
15
19
  _playContent = {};
16
20
  _playContentLoaded = false;
21
+ /**
22
+ * Initializes a new Play instance.
23
+ * @param console The Console instance used for network and media requests.
24
+ * @param playId The unique identifier for this play.
25
+ * @param playRawObj A raw dictionary containing the play's basic metadata.
26
+ */
17
27
  constructor(console, playId, playRawObj) {
18
28
  this._console = console;
19
29
  this._playId = playId;
@@ -31,54 +41,86 @@ export class Play {
31
41
  }
32
42
  this._playContentLoaded = false;
33
43
  }
44
+ /**
45
+ * Constructs the relative path for a media file associated with this play.
46
+ * @param mediaName The name of the media file.
47
+ * @returns The relative media path string.
48
+ */
34
49
  getPlayMediaPath(mediaName) {
35
50
  return `media/game/${this._playGameId}/play/${this._playId}/${mediaName}`;
36
51
  }
52
+ /**
53
+ * Generates the fully qualified URL to access a specific play media file.
54
+ * @param mediaName The name of the media file.
55
+ * @returns The full URL string.
56
+ */
37
57
  getMediaLink(mediaName) {
38
58
  let mediaPath = this.getPlayMediaPath(mediaName);
39
59
  return this._console.getMediaUrl(mediaPath);
40
60
  }
61
+ /**
62
+ * Asynchronously fetches the raw binary or parsed content of a specific media file.
63
+ * @param mediaName The name of the media file to fetch.
64
+ * @returns A promise resolving to the parsed media data (Blob, JSON, Text, etc.).
65
+ */
41
66
  async getMediaContent(mediaName) {
42
67
  let mediaPath = this.getPlayMediaPath(mediaName);
43
68
  return await this._console.getMedia(mediaPath);
44
69
  }
70
+ /**
71
+ * Asynchronously fetches the core data payload of the play using its registered file name.
72
+ * @returns A promise resolving to the play's main data object.
73
+ */
45
74
  async getMediaData() {
46
75
  return await this.getMediaContent(this._playFileName);
47
76
  }
77
+ /**
78
+ * Downloads and caches the main content of the play into memory, marking it as loaded.
79
+ */
48
80
  async updatePlayContent() {
49
81
  this._playContent = await this.getMediaData();
50
82
  this._playContentLoaded = true;
51
83
  }
84
+ /**
85
+ * Gets the loaded content dictionary of the play.
86
+ */
52
87
  get playContent() {
53
88
  return this._playContent;
54
89
  }
90
+ /**
91
+ * Checks if the play's main content has been fully loaded into memory.
92
+ * @returns True if the content is loaded, false otherwise.
93
+ */
55
94
  isPlayContentLoaded() {
56
95
  return this._playContentLoaded;
57
96
  }
58
97
  /**
59
- * Get the data of the play
98
+ * Retrieves the file name serving as the main data entry point for the play.
60
99
  */
61
100
  get data() {
62
101
  return this._playFileName;
63
102
  }
64
103
  /**
65
- * Get the id of the play
104
+ * Retrieves the unique identifier of the play.
66
105
  */
67
106
  get id() {
68
107
  return this._playId;
69
108
  }
70
109
  /**
71
- * Get the name of the play
110
+ * Retrieves the name of the play.
72
111
  */
73
112
  get name() {
74
113
  return this._playName;
75
114
  }
76
115
  /**
77
- * Get the image base64
116
+ * Retrieves the Base64 encoded thumbnail image of the play.
78
117
  */
79
118
  get image() {
80
119
  return this._playImagebase64;
81
120
  }
121
+ /**
122
+ * Checks if the play data is currently in a refreshed state.
123
+ */
82
124
  get isRefreshed() {
83
125
  return this._refreshed;
84
126
  }
@@ -1,12 +1,31 @@
1
+ /**
2
+ * Represents a Resident entity within the Koppelia ecosystem.
3
+ * Handles the resident's personal details and dynamic media URLs.
4
+ */
1
5
  export declare class Resident {
2
6
  private _name;
3
7
  private _id;
4
8
  private _image;
5
9
  private _residenceId;
6
10
  constructor();
11
+ /**
12
+ * Gets the unique identifier of the resident.
13
+ */
7
14
  get id(): string;
15
+ /**
16
+ * Gets the full name of the resident.
17
+ */
8
18
  get name(): string;
19
+ /**
20
+ * Constructs and retrieves the full URL to the resident's profile image.
21
+ * Uses the Koppelia singleton to resolve the correct media path.
22
+ * @returns The full URL string for the image.
23
+ */
9
24
  get imageUrl(): string;
25
+ /**
26
+ * Hydrates the Resident instance using properties from a provided raw object.
27
+ * @param object A dictionary containing the resident's properties.
28
+ */
10
29
  fromObject(object: {
11
30
  [key: string]: string;
12
31
  }): void;
@@ -1,4 +1,8 @@
1
1
  import { Koppelia } from "./koppelia.js";
2
+ /**
3
+ * Represents a Resident entity within the Koppelia ecosystem.
4
+ * Handles the resident's personal details and dynamic media URLs.
5
+ */
2
6
  export class Resident {
3
7
  _name = "";
4
8
  _id = "";
@@ -6,17 +10,33 @@ export class Resident {
6
10
  _residenceId = "";
7
11
  constructor() {
8
12
  }
13
+ /**
14
+ * Gets the unique identifier of the resident.
15
+ */
9
16
  get id() {
10
17
  return this._id;
11
18
  }
19
+ /**
20
+ * Gets the full name of the resident.
21
+ */
12
22
  get name() {
13
23
  return this._name;
14
24
  }
25
+ /**
26
+ * Constructs and retrieves the full URL to the resident's profile image.
27
+ * Uses the Koppelia singleton to resolve the correct media path.
28
+ * @returns The full URL string for the image.
29
+ */
15
30
  get imageUrl() {
16
31
  let koppelia = Koppelia.instance;
17
- let path = "/media/residence/" + this._residenceId + "/resident/" + this._id + "/" + this._image;
32
+ let path = "/media/residence/" + this._residenceId + "/resident/" +
33
+ this._id + "/" + this._image;
18
34
  return koppelia.getMediaLink(path);
19
35
  }
36
+ /**
37
+ * Hydrates the Resident instance using properties from a provided raw object.
38
+ * @param object A dictionary containing the resident's properties.
39
+ */
20
40
  fromObject(object) {
21
41
  this._name = object["name"];
22
42
  this._id = object["id"];
@@ -1,4 +1,8 @@
1
1
  import { Koppelia } from "./koppelia.js";
2
+ /**
3
+ * Represents a Song entity, managing its metadata (artist, album, year)
4
+ * and providing access to its associated media files (audio tracks, cover, lyrics).
5
+ */
2
6
  export declare class Song {
3
7
  private _id;
4
8
  private _name;
@@ -23,14 +27,46 @@ export declare class Song {
23
27
  get style(): string;
24
28
  get year(): number;
25
29
  get length(): number;
30
+ /**
31
+ * Retrieves the base media folder path for this specific song.
32
+ * @returns The relative path to the song's media directory.
33
+ */
26
34
  getSongsFolderPath(): string;
35
+ /**
36
+ * Constructs the full URL for a specific media file within the song's folder.
37
+ * @param mediaName The file name of the media asset.
38
+ * @returns The fully qualified URL to access the media.
39
+ */
27
40
  getMediaUrl(mediaName: string): string;
41
+ /**
42
+ * Gets the URL for the main audio track.
43
+ */
28
44
  get songUrl(): string;
45
+ /**
46
+ * Gets the URL for the album cover image.
47
+ */
29
48
  get coverUrl(): string;
49
+ /**
50
+ * Gets the URL for the lyrics file.
51
+ */
30
52
  get lyricsUrl(): string;
53
+ /**
54
+ * Gets the URL for the backing track (instrumental).
55
+ */
31
56
  get songBackingUrl(): string;
57
+ /**
58
+ * Gets the URL for the vocal/lyrics audio track.
59
+ */
32
60
  get songLyricsUrl(): string;
61
+ /**
62
+ * Asynchronously fetches and reads the lyrics file content as plain text.
63
+ * @returns A promise resolving to the text content of the lyrics.
64
+ */
33
65
  getLyrics(): Promise<string>;
66
+ /**
67
+ * Hydrates the Song instance using properties from a provided raw JSON object.
68
+ * @param object A dictionary containing the song's metadata and file names.
69
+ */
34
70
  fromObject(object: {
35
71
  [key: string]: any;
36
72
  }): void;
@@ -1,4 +1,8 @@
1
1
  import { Koppelia } from "./koppelia.js";
2
+ /**
3
+ * Represents a Song entity, managing its metadata (artist, album, year)
4
+ * and providing access to its associated media files (audio tracks, cover, lyrics).
5
+ */
2
6
  export class Song {
3
7
  _id = "";
4
8
  _name = "";
@@ -40,32 +44,64 @@ export class Song {
40
44
  get length() {
41
45
  return this._length;
42
46
  }
47
+ /**
48
+ * Retrieves the base media folder path for this specific song.
49
+ * @returns The relative path to the song's media directory.
50
+ */
43
51
  getSongsFolderPath() {
44
52
  return "/media/song/" + this._id;
45
53
  }
54
+ /**
55
+ * Constructs the full URL for a specific media file within the song's folder.
56
+ * @param mediaName The file name of the media asset.
57
+ * @returns The fully qualified URL to access the media.
58
+ */
46
59
  getMediaUrl(mediaName) {
47
60
  let koppelia = Koppelia.instance;
48
61
  let path = this.getSongsFolderPath() + "/" + mediaName;
49
62
  return koppelia.getMediaLink(path);
50
63
  }
64
+ /**
65
+ * Gets the URL for the main audio track.
66
+ */
51
67
  get songUrl() {
52
68
  return this.getMediaUrl(this._songFile);
53
69
  }
70
+ /**
71
+ * Gets the URL for the album cover image.
72
+ */
54
73
  get coverUrl() {
55
74
  return this.getMediaUrl(this._coverImage);
56
75
  }
76
+ /**
77
+ * Gets the URL for the lyrics file.
78
+ */
57
79
  get lyricsUrl() {
58
80
  return this.getMediaUrl(this._lyricsFile);
59
81
  }
82
+ /**
83
+ * Gets the URL for the backing track (instrumental).
84
+ */
60
85
  get songBackingUrl() {
61
86
  return this.getMediaUrl(this._songBackingFile);
62
87
  }
88
+ /**
89
+ * Gets the URL for the vocal/lyrics audio track.
90
+ */
63
91
  get songLyricsUrl() {
64
92
  return this.getMediaUrl(this._songLyricsFile);
65
93
  }
94
+ /**
95
+ * Asynchronously fetches and reads the lyrics file content as plain text.
96
+ * @returns A promise resolving to the text content of the lyrics.
97
+ */
66
98
  async getLyrics() {
67
99
  return (await fetch(this.lyricsUrl)).text();
68
100
  }
101
+ /**
102
+ * Hydrates the Song instance using properties from a provided raw JSON object.
103
+ * @param object A dictionary containing the song's metadata and file names.
104
+ */
69
105
  fromObject(object) {
70
106
  this._name = object["name"];
71
107
  this._id = object["id"];
@@ -1,12 +1,43 @@
1
1
  import { Console } from "./console.js";
2
+ /**
3
+ * Manages application routing and views (stages) based on commands from the server.
4
+ * Ensures the local view is synchronized with the network's current stage.
5
+ */
2
6
  export declare class Stage {
3
7
  private _currentStage;
4
8
  private _stages;
5
9
  private _console;
10
+ /**
11
+ * Initializes the stage manager.
12
+ * @param console The Console instance used for network communication.
13
+ */
6
14
  constructor(console: Console);
15
+ /**
16
+ * Updates the local stage from the server.
17
+ * @todo Implementation pending.
18
+ */
7
19
  updateFromServer(): void;
20
+ /**
21
+ * Registers a list of available stages with the server.
22
+ * @param stages An array of stage names.
23
+ */
8
24
  initStages(stages: string[]): void;
25
+ /**
26
+ * Requests a stage transition via the server.
27
+ * @param stage The name of the target stage to navigate to.
28
+ */
9
29
  goto(stage: string): void;
30
+ /**
31
+ * Initializes listeners for incoming stage change commands from the console.
32
+ */
10
33
  private _initEvents;
34
+ /**
35
+ * Handles the reception of a stage change command.
36
+ * Clears all network events to prevent memory leaks, then triggers SvelteKit routing.
37
+ * @param from The origin peer that requested the stage change.
38
+ * @param receivedStage The name of the stage to load.
39
+ */
11
40
  private _onReceiveStage;
41
+ get currentStage(): string;
42
+ get stages(): string[];
12
43
  }
@@ -3,38 +3,72 @@ import { Message } from "./message.js";
3
3
  import { goto } from "$app/navigation";
4
4
  import { routeType } from "../stores/routeStore.js";
5
5
  import { get } from "svelte/store";
6
+ /**
7
+ * Manages application routing and views (stages) based on commands from the server.
8
+ * Ensures the local view is synchronized with the network's current stage.
9
+ */
6
10
  export class Stage {
7
11
  _currentStage = "home";
8
12
  _stages = ["home"];
9
13
  _console;
14
+ /**
15
+ * Initializes the stage manager.
16
+ * @param console The Console instance used for network communication.
17
+ */
10
18
  constructor(console) {
11
19
  this._console = console;
12
20
  this._initEvents();
13
21
  }
22
+ /**
23
+ * Updates the local stage from the server.
24
+ * @todo Implementation pending.
25
+ */
14
26
  updateFromServer() {
15
27
  }
28
+ /**
29
+ * Registers a list of available stages with the server.
30
+ * @param stages An array of stage names.
31
+ */
16
32
  initStages(stages) {
17
33
  let req = new Message();
18
34
  req.setRequest("initStages");
19
35
  req.addParam("stages", stages);
20
36
  this._console.sendMessage(req);
37
+ this._stages = stages;
21
38
  }
39
+ /**
40
+ * Requests a stage transition via the server.
41
+ * @param stage The name of the target stage to navigate to.
42
+ */
22
43
  goto(stage) {
23
44
  let req = new Message();
24
45
  req.setRequest("changeStage");
25
46
  req.addParam("stage", stage);
26
47
  this._console.sendMessage(req);
27
48
  }
49
+ /**
50
+ * Initializes listeners for incoming stage change commands from the console.
51
+ */
28
52
  _initEvents() {
29
- // update the state when receive a change from console
30
53
  this._console.onStageChange((from, stage) => {
31
54
  this._onReceiveStage(from, stage);
32
55
  });
33
56
  }
57
+ /**
58
+ * Handles the reception of a stage change command.
59
+ * Clears all network events to prevent memory leaks, then triggers SvelteKit routing.
60
+ * @param from The origin peer that requested the stage change.
61
+ * @param receivedStage The name of the stage to load.
62
+ */
34
63
  _onReceiveStage(from, receivedStage) {
35
- // Destroy all events before changing stage
36
- this._console.destroyEvents();
64
+ this._currentStage = receivedStage;
37
65
  let path = "/game/" + get(routeType) + "/" + receivedStage;
38
66
  goto(path);
39
67
  }
68
+ get currentStage() {
69
+ return this._currentStage;
70
+ }
71
+ get stages() {
72
+ return this._stages;
73
+ }
40
74
  }
@@ -3,36 +3,53 @@ import { type Writable } from "svelte/store";
3
3
  export type AnyState = {
4
4
  [key: string]: any;
5
5
  };
6
+ /**
7
+ * Manages the synchronized global state of the application.
8
+ * Uses a Svelte writable store locally and syncs changes automatically with the server via the Console.
9
+ */
6
10
  export declare class State {
7
11
  private _globalState;
8
12
  private _console;
9
13
  private _access;
10
14
  private _previousStateValue;
11
15
  private _forceState;
16
+ /**
17
+ * Initializes the state manager.
18
+ * @param console The Console instance used for network communication.
19
+ * @param defaultState The initial state to populate the Svelte store with.
20
+ */
12
21
  constructor(console: Console, defaultState?: AnyState);
22
+ /**
23
+ * Retrieves the Svelte writable store containing the global state.
24
+ * @returns The Svelte writable store.
25
+ */
13
26
  get state(): Writable<AnyState>;
14
27
  /**
15
- * Update the state from the server
28
+ * Requests the latest state from the server and updates the local store upon receiving the response.
16
29
  */
17
30
  updateFromServer(): void;
18
31
  /**
19
- * Force change the state with a new one
20
- * @param newState
32
+ * Completely overwrites the current state with a new state object.
33
+ * @param newState The new state object to apply.
34
+ * @param force If true, forces the entire state payload to be broadcasted instead of just the computed diffs.
21
35
  */
22
36
  setState(newState: AnyState, force?: boolean): void;
23
37
  /**
24
- * Marge a new update to the last one
25
- * @param stateUpdate
38
+ * Merges a partial update into the current global state.
39
+ * @param stateUpdate A dictionary containing only the keys/values to update.
26
40
  */
27
41
  updateState(stateUpdate: AnyState): void;
28
42
  /**
29
- * Init all events
30
- * @param from
31
- * @param any
43
+ * Initializes core events: fetching state on readiness, listening for incoming state changes,
44
+ * and subscribing to the local Svelte store to broadcast outgoing changes.
32
45
  */
33
46
  private _initEvents;
34
47
  /**
35
- * callback when a new state
48
+ * Internal handler executed when a new state is received from the network.
49
+ * Temporarily blocks local store subscriptions to prevent echo-broadcasting the received state.
50
+ * @param from The origin peer of the state.
51
+ * @param receivedState The state object payload.
52
+ * @param update Flag indicating if the payload is a partial update (true) or a full overwrite (false).
36
53
  */
37
54
  private _onReceiveState;
38
55
  }
@@ -2,25 +2,38 @@ import { Console } from "./console.js";
2
2
  import { logger } from "./logger.js";
3
3
  import { Message } from "./message.js";
4
4
  import { get, writable } from "svelte/store";
5
+ /**
6
+ * Manages the synchronized global state of the application.
7
+ * Uses a Svelte writable store locally and syncs changes automatically with the server via the Console.
8
+ */
5
9
  export class State {
6
10
  _globalState;
7
11
  _console;
8
12
  _access = true;
9
13
  _previousStateValue = {};
10
14
  _forceState;
15
+ /**
16
+ * Initializes the state manager.
17
+ * @param console The Console instance used for network communication.
18
+ * @param defaultState The initial state to populate the Svelte store with.
19
+ */
11
20
  constructor(console, defaultState = {}) {
12
21
  this._access = false;
13
22
  this._globalState = writable(defaultState);
14
23
  this._console = console;
15
- this._forceState = false; // force the state without update
24
+ this._forceState = false;
16
25
  this._initEvents();
17
26
  this._access = true;
18
27
  }
28
+ /**
29
+ * Retrieves the Svelte writable store containing the global state.
30
+ * @returns The Svelte writable store.
31
+ */
19
32
  get state() {
20
33
  return this._globalState;
21
34
  }
22
35
  /**
23
- * Update the state from the server
36
+ * Requests the latest state from the server and updates the local store upon receiving the response.
24
37
  */
25
38
  updateFromServer() {
26
39
  let req = new Message();
@@ -31,16 +44,17 @@ export class State {
31
44
  });
32
45
  }
33
46
  /**
34
- * Force change the state with a new one
35
- * @param newState
47
+ * Completely overwrites the current state with a new state object.
48
+ * @param newState The new state object to apply.
49
+ * @param force If true, forces the entire state payload to be broadcasted instead of just the computed diffs.
36
50
  */
37
51
  setState(newState, force = false) {
38
- this._forceState = force; // if force to true -> force the state to be sent entirely instead of sending an update
52
+ this._forceState = force;
39
53
  this._globalState.set(newState);
40
54
  }
41
55
  /**
42
- * Marge a new update to the last one
43
- * @param stateUpdate
56
+ * Merges a partial update into the current global state.
57
+ * @param stateUpdate A dictionary containing only the keys/values to update.
44
58
  */
45
59
  updateState(stateUpdate) {
46
60
  let tempState = get(this._globalState);
@@ -50,20 +64,16 @@ export class State {
50
64
  this.setState(tempState);
51
65
  }
52
66
  /**
53
- * Init all events
54
- * @param from
55
- * @param any
67
+ * Initializes core events: fetching state on readiness, listening for incoming state changes,
68
+ * and subscribing to the local Svelte store to broadcast outgoing changes.
56
69
  */
57
70
  _initEvents() {
58
- // Get the state when the console is ready
59
71
  this._console.onReady(() => {
60
72
  this.updateFromServer();
61
73
  });
62
- // update the state when receive a change from console
63
74
  this._console.onStateChange((from, state, update) => {
64
75
  this._onReceiveState(from, state, update);
65
76
  });
66
- // Send a change state request when detect a state change
67
77
  this._globalState.subscribe((newState) => {
68
78
  if (this._access) {
69
79
  let update = {};
@@ -94,7 +104,11 @@ export class State {
94
104
  });
95
105
  }
96
106
  /**
97
- * callback when a new state
107
+ * Internal handler executed when a new state is received from the network.
108
+ * Temporarily blocks local store subscriptions to prevent echo-broadcasting the received state.
109
+ * @param from The origin peer of the state.
110
+ * @param receivedState The state object payload.
111
+ * @param update Flag indicating if the payload is a partial update (true) or a full overwrite (false).
98
112
  */
99
113
  _onReceiveState(from, receivedState, update) {
100
114
  this._access = false;