-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
7302a0c
commit 1c71d61
Showing
20 changed files
with
255 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import EventEmitter from 'eventemitter3' | ||
import React from 'react' | ||
|
||
export const EventBusContext = React.createContext<EventEmitter>(new EventEmitter()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React, { PropsWithChildren } from 'react' | ||
|
||
import { eventBus } from './eventBus' | ||
import { EventBusContext } from './EventBusContext' | ||
|
||
export const EventBusProvider = ({ children }: PropsWithChildren) => { | ||
return <EventBusContext.Provider value={eventBus}>{children}</EventBusContext.Provider> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import EventEmitter from 'eventemitter3' | ||
|
||
export const eventBus = new EventEmitter() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const SPLASHSCREEN_EVENTS = { | ||
HIDE: 'splashscreen.hide', | ||
SHOW: 'splashscreen.show', | ||
} | ||
|
||
export const NETWORK_EVENTS = { | ||
ONLINE: 'network.online', | ||
OFFLINE: 'network.offline', | ||
} | ||
|
||
export const SNACKBAR_EVENTS = { | ||
SHOW: 'snackbar.show', | ||
HIDE: 'snackbar.hide', | ||
} | ||
|
||
export const NAVIGATION_EVENTS = { | ||
READY: 'navigation.ready', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type SnackBarEventPayload = { | ||
type: 'info' | 'success' | 'error' | ||
message: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { useContext } from 'react' | ||
|
||
import { EventBusContext } from './EventBusContext' | ||
|
||
export const useEventBus = () => useContext(EventBusContext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.