Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion behavior-subject/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@observable/behavior-subject",
"version": "0.12.0",
"version": "0.13.0",
"license": "MIT",
"exports": "./mod.ts",
"publish": { "exclude": ["*.test.ts"] }
Expand Down
8 changes: 5 additions & 3 deletions behavior-subject/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ export interface BehaviorSubjectConstructor {
const stringTag = "BehaviorSubject";

export const BehaviorSubject: BehaviorSubjectConstructor = class<Value> {
static {
Object.freeze(this);
Object.freeze(this.prototype);
}

readonly [Symbol.toStringTag] = stringTag;
readonly #subject = new ReplaySubject<Value>(1);
readonly signal = this.#subject.signal;
Expand Down Expand Up @@ -104,6 +109,3 @@ export const BehaviorSubject: BehaviorSubjectConstructor = class<Value> {
this.#subject.subscribe(observer);
}
};

Object.freeze(BehaviorSubject);
Object.freeze(BehaviorSubject.prototype);
2 changes: 1 addition & 1 deletion broadcast-subject/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@observable/broadcast-subject",
"version": "0.12.0",
"version": "0.13.0",
"license": "MIT",
"exports": "./mod.ts",
"publish": { "exclude": ["*.test.ts"] }
Expand Down
8 changes: 5 additions & 3 deletions broadcast-subject/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ const namespace = "394068c9-9d2c-45cb-81d2-a09197594a9d";
const stringTag = "BroadcastSubject";

export const BroadcastSubject: BroadcastSubjectConstructor = class<Value> {
static {
Object.freeze(this);
Object.freeze(this.prototype);
}

readonly [Symbol.toStringTag] = stringTag;
readonly #subject = new Subject<Value>();
readonly signal = this.#subject.signal;
Expand Down Expand Up @@ -148,6 +153,3 @@ export const BroadcastSubject: BroadcastSubjectConstructor = class<Value> {
this.#subject.subscribe(observer);
}
};

Object.freeze(BroadcastSubject);
Object.freeze(BroadcastSubject.prototype);
2 changes: 1 addition & 1 deletion core/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@observable/core",
"version": "0.12.0",
"version": "0.13.0",
"license": "MIT",
"exports": "./mod.ts",
"publish": { "exclude": ["*.test.ts"] }
Expand Down
8 changes: 5 additions & 3 deletions core/observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ export interface ObservableConstructor {
const stringTag = "Observable";

export const Observable: ObservableConstructor = class<Value> {
static {
Object.freeze(this);
Object.freeze(this.prototype);
}

readonly [Symbol.toStringTag] = stringTag;
readonly #subscribe: (observer: Observer<Value>) => void;

Expand Down Expand Up @@ -159,9 +164,6 @@ export const Observable: ObservableConstructor = class<Value> {
}
};

Object.freeze(Observable);
Object.freeze(Observable.prototype);

/**
* Checks if a {@linkcode value} is an object that implements the {@linkcode Observable} interface.
* @example
Expand Down
8 changes: 5 additions & 3 deletions core/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export interface ObserverConstructor {
const stringTag = "Observer";

export const Observer: ObserverConstructor = class<Value> {
static {
Object.freeze(this);
Object.freeze(this.prototype);
}

readonly [Symbol.toStringTag] = stringTag;
readonly #observer?: Partial<Observer<Value>> | null;
readonly #controller = new AbortController();
Expand Down Expand Up @@ -155,9 +160,6 @@ export const Observer: ObserverConstructor = class<Value> {
}
};

Object.freeze(Observer);
Object.freeze(Observer.prototype);

/**
* Checks if a {@linkcode value} is an object that implements the {@linkcode Observer} interface.
* @example
Expand Down
8 changes: 5 additions & 3 deletions core/subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ const notThrown = Symbol("Flag indicating that a value is not thrown.");
const stringTag = "Subject";

export const Subject: SubjectConstructor = class<Value> {
static {
Object.freeze(this);
Object.freeze(this.prototype);
}

readonly [Symbol.toStringTag] = stringTag;
/**
* Tracking the value that was thrown by the [producer](https://jsr.io/@observable/core#producer), if any.
Expand Down Expand Up @@ -205,9 +210,6 @@ export const Subject: SubjectConstructor = class<Value> {
}
};

Object.freeze(Subject);
Object.freeze(Subject.prototype);

/**
* Checks if a {@linkcode value} is an object that implements the {@linkcode Subject} interface.
* @example
Expand Down
2 changes: 1 addition & 1 deletion replay-subject/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@observable/replay-subject",
"version": "0.15.0",
"version": "0.16.0",
"license": "MIT",
"exports": "./mod.ts",
"publish": { "exclude": ["*.test.ts"] }
Expand Down
8 changes: 5 additions & 3 deletions replay-subject/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ export interface ReplaySubjectConstructor {
const stringTag = "ReplaySubject";

export const ReplaySubject: ReplaySubjectConstructor = class<Value> {
static {
Object.freeze(this);
Object.freeze(this.prototype);
}

readonly [Symbol.toStringTag] = stringTag;
readonly #count: number;
/**
Expand Down Expand Up @@ -421,6 +426,3 @@ export const ReplaySubject: ReplaySubjectConstructor = class<Value> {
this.#observable.subscribe(observer);
}
};

Object.freeze(ReplaySubject);
Object.freeze(ReplaySubject.prototype);
Loading