Skip to content

Commit dbe5d9f

Browse files
committed
Update package.json
1 parent 66719cd commit dbe5d9f

File tree

15 files changed

+1734
-2018
lines changed

15 files changed

+1734
-2018
lines changed

dist/constants.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export declare const isAndroid: boolean;
2+
export declare const isIOS: boolean;
3+
export declare const ANDROID_VERSION: number;
4+
export declare const IOS_VERSION: string;

dist/constants.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.IOS_VERSION = exports.ANDROID_VERSION = exports.isIOS = exports.isAndroid = void 0;
4+
const react_native_1 = require("react-native");
5+
exports.isAndroid = react_native_1.Platform.OS === "android";
6+
exports.isIOS = react_native_1.Platform.OS === "ios";
7+
// on Android Version returns number on iOS string
8+
// https://reactnative.dev/docs/platform#version
9+
exports.ANDROID_VERSION = exports.isIOS ? 0 : react_native_1.Platform.Version;
10+
exports.IOS_VERSION = exports.isIOS ? react_native_1.Platform.Version : "";

dist/hooks.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export declare function useBoolean(initialVal?: boolean): [boolean, () => void, () => void, () => void];

dist/hooks.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.useBoolean = void 0;
4+
const react_1 = require("react");
5+
// /**
6+
// * hook version of interval timer, should behave the same without
7+
// * the pesky inconvenience of creating a new timer on each frame render
8+
// * If the passed delay is null or undefined this is a noop
9+
// * @return void
10+
// */
11+
// export function useInterval(callback: () => void, delay: ?number) {
12+
// const savedCallback = useRef();
13+
// // Remember the latest callback.
14+
// useEffect(() => {
15+
// savedCallback.current = callback;
16+
// }, [callback]);
17+
// // Set up the interval.
18+
// useEffect(() => {
19+
// function tick() {
20+
// if (savedCallback.current) {
21+
// savedCallback.current();
22+
// }
23+
// }
24+
// if (delay != null) {
25+
// const id = setInterval(tick, delay);
26+
// return () => clearInterval(id);
27+
// }
28+
// }, [delay]);
29+
// }
30+
// export function useBackHandler(handler?: () => mixed) {
31+
// const savedHandler = useRef(null);
32+
// useEffect(() => {
33+
// savedHandler.current = handler;
34+
// }, [handler]);
35+
// useFocusEffect(
36+
// useCallback(() => {
37+
// const eventListener = () => {
38+
// // There is a problem here; 'hardwareBackPress' requires the function to return "true"
39+
// // to prevent bubling up of the press event, which we are not enforcing...
40+
// // eslint-disable-next-line
41+
// savedHandler.current?.();
42+
// };
43+
// BackHandler.addEventListener("hardwareBackPress", eventListener);
44+
// return () => {
45+
// BackHandler.removeEventListener("hardwareBackPress", eventListener);
46+
// };
47+
// // passing empty dependency array to useCallback ensures focus effect will only run once on mount
48+
// // and the clean-up function will only run once on unmount as well
49+
// // wether the internal handler function is correctly updated is another problem
50+
// }, [])
51+
// );
52+
// }
53+
function useBoolean(initialVal = false) {
54+
const [val, setVal] = (0, react_1.useState)(initialVal);
55+
function setTrue() {
56+
setVal(true);
57+
}
58+
function setFalse() {
59+
setVal(false);
60+
}
61+
function toggle() {
62+
setVal(!val);
63+
}
64+
return [val, setTrue, setFalse, toggle];
65+
}
66+
exports.useBoolean = useBoolean;
67+
// export function usePolling(fn: () => Promise<unknown>, ms: number) {
68+
// let timeout = useRef<number | null>(null);
69+
// useFocusEffect(
70+
// useCallback(() => {
71+
// const wrapper = () => {
72+
// fn()
73+
// .then(() => {
74+
// timeout.current = setTimeout(() => {
75+
// wrapper();
76+
// }, ms);
77+
// })
78+
// .catch(() => {
79+
// timeout.current = setTimeout(() => {
80+
// wrapper();
81+
// }, ms);
82+
// });
83+
// };
84+
// wrapper();
85+
// return () => {
86+
// if (timeout.current) {
87+
// clearTimeout(timeout.current);
88+
// }
89+
// };
90+
// }, [fn, ms])
91+
// );
92+
// }

dist/invariant.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export declare class InvariantError extends Error {
2+
framesToPop: number;
3+
name: string;
4+
constructor(message?: string | number);
5+
}
6+
export declare function invariant(condition: boolean, message?: string | number): asserts condition;

dist/invariant.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.invariant = exports.InvariantError = void 0;
4+
const genericMessage = "Invariant Violation";
5+
const { setPrototypeOf = function (obj, proto) {
6+
// eslint-disable-next-line no-proto
7+
obj.__proto__ = proto;
8+
return obj;
9+
}, } = Object;
10+
class InvariantError extends Error {
11+
constructor(message = genericMessage) {
12+
super(typeof message === "number"
13+
? `${genericMessage}: ${message} (see https://github.com/apollographql/invariant-packages)`
14+
: message);
15+
this.framesToPop = 1;
16+
this.name = genericMessage;
17+
setPrototypeOf(this, InvariantError.prototype);
18+
}
19+
}
20+
exports.InvariantError = InvariantError;
21+
function invariant(condition, message) {
22+
if (!condition) {
23+
throw new InvariantError(message);
24+
}
25+
}
26+
exports.invariant = invariant;

dist/logs.d.ts

Whitespace-only changes.

dist/logs.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-ignore
2+
global.marker = (i = 0) => {
3+
// @ts-ignore
4+
debug(`🔷🔷🔷🔷🔷🔷🔷🔷🔷🔷🔷🔷 MARK ${i} 🔷🔷🔷🔷🔷🔷🔷🔷🔷🔷🔷🔷🔷🔷`);
5+
};
6+
// @ts-ignore
7+
global.debug = (input) => {
8+
console.debug(new Date().toLocaleTimeString(), JSON.stringify(input, null, 2));
9+
};

dist/nullthrows.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export declare class NullthrowsError extends Error {
2+
framesToPop: number;
3+
name: string;
4+
constructor(message?: string | number);
5+
}
6+
export declare function nullthrows(obj: any, message?: string | number): asserts obj;

dist/nullthrows.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.nullthrows = exports.NullthrowsError = void 0;
4+
const genericMessage = "Nullthrows Violation";
5+
const { setPrototypeOf = function (obj, proto) {
6+
obj.__proto__ = proto;
7+
return obj;
8+
}, } = Object;
9+
class NullthrowsError extends Error {
10+
constructor(message = genericMessage) {
11+
super(typeof message === "number"
12+
? `${genericMessage}: ${message} (see https://github.com/apollographql/invariant-packages)`
13+
: message);
14+
this.framesToPop = 1;
15+
this.name = genericMessage;
16+
setPrototypeOf(this, NullthrowsError.prototype);
17+
}
18+
}
19+
exports.NullthrowsError = NullthrowsError;
20+
function nullthrows(obj, message) {
21+
if (obj == null) {
22+
throw new NullthrowsError(message);
23+
}
24+
}
25+
exports.nullthrows = nullthrows;

0 commit comments

Comments
 (0)