Skip to content

Commit

Permalink
added support for routing
Browse files Browse the repository at this point in the history
  • Loading branch information
aminnairi committed May 8, 2024
1 parent e131cae commit 6ec251b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/arachnide/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export type ViewOptions<State, ApplicationEvent> = {
* this function should not change and its reference will remain stable
* accross renders
*/
emit: Emitter<ApplicationEvent>
emit: Emitter<ApplicationEvent>,
go: Go
}

/**
Expand Down Expand Up @@ -138,6 +139,8 @@ export type UpdateOptions<ApplicationEvent, State> = {
*/
export type Update<ApplicationEvent, State> = (options: UpdateOptions<ApplicationEvent, State>) => State

export type Go = (path: string, parameters: Record<string, unknown>) => void;

/**
* this is the list of options that you are allowed to pass to the application
* function and that is responsible for connecting your state, your view and
Expand All @@ -152,7 +155,7 @@ export type ApplicationOptions<State, EventName> = {
* inforamtions along with the event emitter function allowing you to update
* the state of your application
*/
view: View<State, EventName>,
views: Record<string, View<State, EventName>>,
/**
* This is the HTML element that needs to be available in your HTML document
* in order to inject and update your application view, make sure to pass an
Expand Down

0 comments on commit 6ec251b

Please sign in to comment.