Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: simplify Kadoa logic #1

Merged
merged 1 commit into from
Feb 3, 2025
Merged
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
14 changes: 5 additions & 9 deletions node/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { Realtime } from "./realtime";

export class Kadoa {
private teamApiKey?: string;
private _realtime?: Realtime;

constructor(props: { apiKey?: string; teamApiKey?: string }) {
if (!props.apiKey && !props.teamApiKey) {
throw new Error("apiKey or teamApiKey must be passed");
constructor(private teamApiKey?: string) {
if (!teamApiKey) {
throw new Error("teamApiKey must be provided");
}
this.teamApiKey = props.teamApiKey;
}

get realtime() {
if (!this._realtime) {
this._realtime = new Realtime(this.teamApiKey);
}
return this._realtime;
return this._realtime ??= new Realtime(this.teamApiKey);
}
}

Expand Down