Skip to content

Commit

Permalink
clientAtom -> clientImplAtom
Browse files Browse the repository at this point in the history
  • Loading branch information
disjukr committed Jul 18, 2022
1 parent c49a8b6 commit 921d74f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/jotai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { createWrpGuest, WrpGuest } from "../guest.ts";
export type SocketAtom = Atom<Promise<Socket | undefined>>;
export type ChannelAtom = Atom<WrpChannel | undefined>;
export type GuestAtom = Atom<WrpGuest | undefined>;
export type ClientAtom = Atom<RpcClientImpl | undefined>;
export type ClientImplAtom = Atom<RpcClientImpl | undefined>;
export interface WrpAtomSet {
channelAtom: ChannelAtom;
guestAtom: GuestAtom;
clientAtom: ClientAtom;
clientImplAtom: ClientImplAtom;
}
export function createWrpAtomSet(socketAtom: SocketAtom): WrpAtomSet {
interface ChannelAndGuest {
Expand Down Expand Up @@ -62,10 +62,10 @@ export function createWrpAtomSet(socketAtom: SocketAtom): WrpAtomSet {
channelAndGuestAtom,
(cag) => cag?.guest,
);
const clientAtom = atom<RpcClientImpl | undefined>((get) => {
const clientImplAtom = atom<RpcClientImpl | undefined>((get) => {
const guest = get(guestAtom);
if (!guest) return;
return createWrpClientImpl({ guest: guest });
});
return { channelAtom, guestAtom, clientAtom };
return { channelAtom, guestAtom, clientImplAtom };
}
8 changes: 6 additions & 2 deletions src/jotai/parent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createAndroidSocket } from "../glue/android.ts";
import { createParentWindowSocket } from "../glue/parent-window.ts";
import {
ChannelAtom,
ClientAtom,
ClientImplAtom,
createWrpAtomSet,
GuestAtom,
SocketAtom,
Expand All @@ -21,4 +21,8 @@ export const socketAtom: SocketAtom = atom(async () => {
const wrpAtomSet: WrpAtomSet = createWrpAtomSet(socketAtom);
export const channelAtom: ChannelAtom = wrpAtomSet.channelAtom;
export const guestAtom: GuestAtom = wrpAtomSet.guestAtom;
export const clientAtom: ClientAtom = wrpAtomSet.clientAtom;
/**
* @deprecated use `clientImplAtom` instead
*/
export const clientAtom: ClientImplAtom = wrpAtomSet.clientImplAtom;
export const clientImplAtom: ClientImplAtom = wrpAtomSet.clientImplAtom;

0 comments on commit 921d74f

Please sign in to comment.