-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename useLegendStatePauseProvider to usePauseProvider
- Loading branch information
1 parent
c271035
commit a25b5f7
Showing
5 changed files
with
18 additions
and
18 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 was deleted.
Oops, something went wrong.
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,13 @@ | ||
import { Observable, observable } from '@legendapp/state'; | ||
import { ReactNode, createContext, createElement, useState } from 'react'; | ||
|
||
export const PauseContext = createContext<Observable<boolean>>(null as any); | ||
|
||
export function usePauseProvider() { | ||
const [value] = useState(() => observable(false)); | ||
return { | ||
PauseProvider: ({ children }: { children: ReactNode }) => | ||
createElement(PauseContext.Provider, { value }, children), | ||
isPaused$: value, | ||
}; | ||
} |
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