Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Export types
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloud11PL committed Apr 13, 2022
1 parent ec162f1 commit d4c0483
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SSR } from "./constants";
import { Events, EventType, PayloadOfEvent } from "./events";

type State = {
export type AppBridgeState = {
token?: string;
id: string;
ready: boolean;
Expand All @@ -12,7 +12,7 @@ type SubscribeMap = {
[type in EventType]: Record<any, EventCallback<PayloadOfEvent<type>>>;
};

function reducer(state: State, event: Events) {
function reducer(state: AppBridgeState, event: Events) {
switch (event.type) {
case EventType.handshake: {
const newState = {
Expand All @@ -37,7 +37,7 @@ export const app = (() => {
return null as never;
}

let state: State = {
let state: AppBridgeState = {
id: "",
domain: "",
ready: false,
Expand Down Expand Up @@ -122,7 +122,7 @@ export const app = (() => {
return state;
}

function setState(newState: Partial<State>) {
function setState(newState: Partial<AppBridgeState>) {
state = {
...state,
...newState,
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ export function createApp(targetDomain?: string) {

export * from "./events";
export * from "./actions";
export * from "./types";
export default createApp;
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import createApp from ".";
import { AppBridgeState } from "./app";

export type App = typeof createApp;
export { AppBridgeState };

0 comments on commit d4c0483

Please sign in to comment.