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 27, 2024
1 parent 8060985 commit 4d516be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 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();
}
}
17 changes: 5 additions & 12 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 @@ -864,10 +864,7 @@ export class Document<T, P extends Indexable = Indexable> {
* The callback will be called when the document is changed.
*/
public subscribe(
type: {
type: 'broadcast';
topic: string;
},
type: BroadcastSubscribePair,
next: DocEventCallbackMap<P>['broadcast'],
error?: ErrorFn,
): Unsubscribe;
Expand Down Expand Up @@ -1333,12 +1330,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 +2084,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 4d516be

Please sign in to comment.