@pollar/core 0.8.2 → 0.9.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,19 +11,12 @@
11
11
  * the cases where `visibilitychange` lags). Default for non-browser
12
12
  * environments is a noop that always reports "visible".
13
13
  *
14
- * TODO(@pollar/react-native): when the dedicated RN package ships, it will
15
- * export an `AppState`-backed provider. Until then, RN consumers can wire
16
- * one inline:
14
+ * React Native: import the shipped `AppState`-backed provider and pass it via
15
+ * `PollarClientConfig.visibilityProvider`:
17
16
  *
18
- * import { AppState } from 'react-native';
19
- * const rnVisibility = {
20
- * isVisible: () => AppState.currentState === 'active',
21
- * onChange: (cb) => {
22
- * const sub = AppState.addEventListener('change', (s) => cb(s === 'active'));
23
- * return () => sub.remove();
24
- * },
25
- * };
26
- * new PollarClient({ apiKey, visibilityProvider: rnVisibility });
17
+ * import { createAppStateVisibilityProvider } from '@pollar/core/adapters/react-native-appstate';
18
+ * const visibilityProvider = await createAppStateVisibilityProvider();
19
+ * new PollarClient({ apiKey, visibilityProvider });
27
20
  */
28
21
  interface VisibilityProvider {
29
22
  isVisible(): boolean;
@@ -11,19 +11,12 @@
11
11
  * the cases where `visibilitychange` lags). Default for non-browser
12
12
  * environments is a noop that always reports "visible".
13
13
  *
14
- * TODO(@pollar/react-native): when the dedicated RN package ships, it will
15
- * export an `AppState`-backed provider. Until then, RN consumers can wire
16
- * one inline:
14
+ * React Native: import the shipped `AppState`-backed provider and pass it via
15
+ * `PollarClientConfig.visibilityProvider`:
17
16
  *
18
- * import { AppState } from 'react-native';
19
- * const rnVisibility = {
20
- * isVisible: () => AppState.currentState === 'active',
21
- * onChange: (cb) => {
22
- * const sub = AppState.addEventListener('change', (s) => cb(s === 'active'));
23
- * return () => sub.remove();
24
- * },
25
- * };
26
- * new PollarClient({ apiKey, visibilityProvider: rnVisibility });
17
+ * import { createAppStateVisibilityProvider } from '@pollar/core/adapters/react-native-appstate';
18
+ * const visibilityProvider = await createAppStateVisibilityProvider();
19
+ * new PollarClient({ apiKey, visibilityProvider });
27
20
  */
28
21
  interface VisibilityProvider {
29
22
  isVisible(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pollar/core",
3
- "version": "0.8.2",
3
+ "version": "0.9.0-rc.0",
4
4
  "description": "Core authentication functions for Pollar services",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",