@trackunit/react-core-hooks
Advanced tools
Comparing version 0.0.35 to 0.0.37
@@ -1,4 +0,4 @@ | ||
export * from "./environment/useEnvironment"; | ||
export * from "./environment/EnvironmentContextProvider"; | ||
export * from "./subscription/UserSubscriptionProvider"; | ||
export * from "./token/TokenProvider"; | ||
export * from "./user/CurrentUserProvider"; |
31
index.js
@@ -0,16 +1,5 @@ | ||
import { jsx } from 'react/jsx-runtime'; | ||
import * as React from 'react'; | ||
import { createContext, useContext } from 'react'; | ||
import { jsx } from 'react/jsx-runtime'; | ||
import { useContext, createContext } from 'react'; | ||
const EnvironmentContext = /*#__PURE__*/createContext(null); | ||
const useEnvironment = () => { | ||
const context = useContext(EnvironmentContext); | ||
if (!context) { | ||
throw new Error("useEnvironment must be used within an EnvironmentContext"); | ||
} | ||
return context; | ||
}; | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
@@ -1044,2 +1033,16 @@ | ||
const EnvironmentContext = /*#__PURE__*/createContext(null); | ||
const EnvironmentContextProvider = props => { | ||
return jsx(EnvironmentContext.Provider, Object.assign({}, props)); | ||
}; | ||
const useEnvironment = () => { | ||
const context = useContext(EnvironmentContext); | ||
if (!context) { | ||
throw new Error("useEnvironment must be used within an EnvironmentContext"); | ||
} | ||
return context; | ||
}; | ||
const UserSubscriptionContext = /*#__PURE__*/React.createContext(null); | ||
@@ -1087,2 +1090,2 @@ const UserSubscriptionProvider = props => { | ||
export { CurrentUserProvider, EnvironmentContext, TokenProvider, UserSubscriptionProvider, useCurrentUser, useEnvironment, useToken, useUserSubscription }; | ||
export { CurrentUserProvider, EnvironmentContextProvider, TokenProvider, UserSubscriptionProvider, useCurrentUser, useEnvironment, useToken, useUserSubscription }; |
{ | ||
"name": "@trackunit/react-core-hooks", | ||
"version": "0.0.35", | ||
"version": "0.0.37", | ||
"repository": "https://github.com/Trackunit/manager", | ||
@@ -11,3 +11,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@trackunit/react-core-contexts-api": "0.0.35", | ||
"@trackunit/react-core-contexts-api": "0.0.36", | ||
"react": "17.0.1" | ||
@@ -14,0 +14,0 @@ }, |
37773
938
+ Added@trackunit/react-core-contexts-api@0.0.36(transitive)
- Removed@trackunit/react-core-contexts-api@0.0.35(transitive)