Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
PS committed Nov 18, 2024
1 parent 5f2185a commit 5a5493c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export interface Settings {
$Render: PageRendererSettings;
};
$Observable?: {
maxHistoryLength: number;
maxHistoryLength?: number;
};
}

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/event/ObservableImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Settings } from '../boot';
import { Dependencies } from '../oc/ObjectContainer';
import { RouterEvents } from '../router/RouterEvents';

const MAX_HISTORY_LENGTH = 10;

/**
* An Observable is a class that manages event listeners and allows distributing
* events to the registered listeners. It maintains a history of events and supports
Expand Down Expand Up @@ -161,7 +163,7 @@ export class ObservableImpl extends Observable {
event,
this._activityHistory
.get(event)!
.splice(-(this._settings?.maxHistoryLength || 10))
.splice(-(this._settings?.maxHistoryLength || MAX_HISTORY_LENGTH))
);

if (!this._observers.has(event)) {
Expand Down

0 comments on commit 5a5493c

Please sign in to comment.