Skip to content

Commit

Permalink
Merge pull request #159 from vigenere23/export-event-types
Browse files Browse the repository at this point in the history
Exported event types
  • Loading branch information
ItalyPaleAle authored Oct 29, 2020
2 parents 7cf1560 + 380e6d3 commit 68a3d71
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ interface RouterEvent<T> {
detail: T
}

/** Event type for conditionsFailed */
export type ConditionsFailedEvent = RouterEvent<RouteDetail>

/** Event type for routeLoading */
export type RouteLoadingEvent = RouterEvent<RouteDetail>

/** Event type for routeLoaded */
export type RouteLoadedEvent = RouterEvent<RouteDetailLoaded>

/**
* Router component
*/
Expand Down Expand Up @@ -190,6 +199,7 @@ export default class Router extends SvelteComponent {
}

$on(event: 'routeEvent', callback: (event: CustomEvent) => void): () => void
$on(event: 'routeLoading' | 'conditionsFailed', callback: (event: RouterEvent<RouteDetail>) => void): () => void
$on(event: 'routeLoaded', callback: (event: RouterEvent<RouteDetailLoaded>) => void): () => void
$on(event: 'conditionsFailed', callback: (event: ConditionsFailedEvent) => void): () => void
$on(event: 'routeLoading', callback: (event: RouteLoadingEvent) => void): () => void
$on(event: 'routeLoaded', callback: (event: RouteLoadedEvent) => void): () => void
}

0 comments on commit 68a3d71

Please sign in to comment.