Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gwbaik9717 committed Aug 26, 2024
1 parent 8060985 commit 84e8762
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/src/client/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ export class Attachment<T, P extends Indexable> {
* `unsetClient` unsets the client of the document.
*/
public unsetClient(): void {
this.doc.setClient(null);
this.doc.setClient();
}
}
12 changes: 4 additions & 8 deletions packages/sdk/src/document/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ export class Document<T, P extends Indexable = Indexable> {
DocEventCallbackMap<P>['broadcast']
>;

private client: Client | null = null;
private client?: Client;

constructor(key: string, opts?: DocumentOptions) {
this.opts = opts || {};
Expand Down Expand Up @@ -1333,12 +1333,12 @@ export class Document<T, P extends Indexable = Indexable> {
return this.root.getGarbageLen();
}

/*
/**
* `setClient` sets the client of this document.
*
* @internal
*/
public setClient(client: Client | null): void {
public setClient(client?: Client): void {
this.client = client;
}

Expand Down Expand Up @@ -2087,11 +2087,7 @@ export class Document<T, P extends Indexable = Indexable> {
*/
public broadcast(topic: string, payload: any): Promise<void> {
if (this.client) {
try {
return this.client.broadcast(this.getKey(), topic, payload);
} catch (e) {
throw e;
}
return this.client.broadcast(this.getKey(), topic, payload);
}

throw new YorkieError(
Expand Down

0 comments on commit 84e8762

Please sign in to comment.